HOMEWORK ASSIGNMENT #1
Assigned Date: Friday, September 3, 2004
Due Date: Monday, September 13, 2004
Due Time: 3pm
Updated: Wednesday, September 8, 2004, 4:26 PM.
This assignment will get you comfortable with Python.
All programs that you complete in your career as a student and as a professional developer should be fully documented. Follow 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.”  Obviously, you should comment any variable, obscure statement, block of code, method, and class you create. Your comments should express why something is being done, as opposed to how – the how is shown by the code.
In this course, you should always include opening comments as follows:
# Author: <Your Name>
# Email: <Your email address>
# Class: CSCI 470, Section 1
# Assignment: HMWK1
# Due Date: <The assignment's due date>
# Certification of Authenticity <include one of the following>:
# I certify that this lab is entirely my own work.
# I certify that this lab is my own work, but I received
# some assistance from: <Name(s)>
# Purpose: <Provide a simple, yet complete description of the task being
# performed by this program. It may be several sentences long.>
# Input: <Provide a simple, yet complete description of the input required
# by this program.>
# Output: <Provide a simple, yet complete description of the output generated
# by this program.>
Write the following programs (1-4 adapted from ):
(Learning objectives: program structure, simple math,
Modify chaos.py so that the number of output values is provided by the user through the standard input.
(Learning objectives: math, I/O)
Write a program that accepts two coordinate points (x1, y1) and (x2, y2) and outputs their Euclidean distance. User provides four numbers through the standard input.
(Learning objectives: string manipulation and
Write a program that calculates the average word length in a sentence entered by the user through the standard input.
(Learning objectives: functions and recursion)
Write a program which includes a function fib(n) to calculate the nth Fibonacci number recursively – n is provided by the user through the standard input.
(Learning objectives: classes and porting from Java)
Write a program containing a class Die (see Die.java) and main() method, which asks the user how many faces the die should have, and how many rolls of the die to output. User provides two numbers through the standard input.
(Learning objectives: putting it all together and a bit
To create a Golden Tree, simply draw a line from some starting point (x, y) towards the 12 o’clock direction. Then draw a line from the ending point, 60 degrees clockwise, with length reduced by the golden ratio -- phi = 0.6180339887… . Then draw a similar line 60 degrees counterclockwise, and so on.
Write a program that draws a Golden Tree of level n (see exampleTkinter.py). Use recursive method drawGoldenTree(start_x, start_y, length, rotation, level). Your program should be invoked with: python GoldenTree.py n, from the command line, where n is the level. It should output trace information for each recursive call (output drawGoldenTree’s arguments via ‘print’).
You should submit your source file on a floppy disk, as per syllabus instructions.
Source filenames to be submitted: A directory named <firstName_lastName_fourLastDigitsofSSN>_hmwk1 (for example, Bill_Manaris_2308_hmwk1). This directory should contain the following files:
· NewChaos.py, EuclideanDistance.py, AverageWordLength.py, RecursiveFibonacci.py, DieRoll.py, and GoldenTree.py