Spring 2018»CITA 180 Homework 1

CITA 180 Homework 1

Assigned Date: Friday, Jan. 19, 2018
Due Date: Friday, Jan. 26
Due Time: 30 mins before class

Last modified on January 18, 2018, at 07:21 PM (see updates)


Find a complete, interesting melody.

Write a Python program that plays it.


Do all three:

  1. Upload your program file on OAKS.
  2. Hand in a printout of your Python program in class on the due date.
  3. Be ready to perform it in class.

Your program should have a meaningful name, e.g., stairwayToHeaven.py.

Program Documentation

The Golden Rule of Style:

"A program should be as easy for a human being to read and understand as it is for a computer to execute." [1]

Also, see literate programming:

"Under the literate programming paradigm, the central activity of programming becomes that of conveying meaning to other intelligent beings rather than merely convincing the computer to behave in a particular way. It is the difference between performing and exposing a magic trick."

Your code should have general comments at the top, which explain what the program does.

You should comment all variables, obscure statements, and blocks of code.

Follow the textbook examples on how to write comments.

Copy and paste the following into the top of your program. Update it, to fit what your program does.

# <name of your program>.py
# Author:     <Your name>
# Email:      <Your email address>
# Class:      <Your class and section number>
# Assignment: Homework #1
# Due Date:   <The assignment due date>
# Purpose: To play the melody of <name of piece> using Python.
# <Include URL of music score, etc.  - anything that you referenced online to make this program.>
# Input:   None.
# Output:  The melody played by the computer.


For extra points, once you complete the main assignment, you may submit a separate, additional program.

  • Any other idea you can think of is fine.
  • For full credit, use comments in the program to document your idea.
  • Give the program a meaningful name.


Your grade will be based on how well you followed the above instructions, and the depth/quality of your work.

Learning Objectives

This assignment has the following objectives:

  • Understand the fundamentals of music theory.
  • Analyze music and create musical studies modeled on pre-existing works.
  • Apply numeric data types to represent information.
  • Use variables in program development.
  • Use predefined classes in program development (object-based programming).

Also how to:

  • Create an interesting melody with JythonMusic


  1. Cooper, D. and Clancy, M. (1985) "Oh! Pascal", 2nd ed., W.W. Norton & Company, New York, p. 42.