Assigned Date: Friday, Sep. 7, 2007
Due Dates: Monday, Sep. 17, 2007
Due Time: 11:55pm
Last modified on September 13, 2007, at 10:40 PM (see updates)
- Create a Python program on your own.
- Develop a simple Python program that does arithmetic.
piApproximator.py that approximates the value of π by summing the terms of this series: 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ... The program should prompt the user for n, the number of terms to sum, and then output the sum of the first n terms of this series.
Have your program subtract the approximation from the value of
math.pi to see how accurate it is.
(This is exercise 15 on p. 74 of the text.)
Use ideas from chaosTurtle.py to visualize how close your approximation is. (Hint: Draw two lines, one with length equal to π*100, and the other with length that slowly increases as the approximation is getting better.
Do this in a separate program,
piApproximator.py file as an attachment.
Email subject should be "Assignment #1".
My email address is email@example.com.
(If you do the bonus, submit both programs in the same email, as attachments.)
The following policies are in effect for this assignment:
- Programming assignment grades will be based on design and style as well as correctness of result.
- You may discuss the problem and how to solve it with others, but you may not look at, copy, or use any code (or pseudocode) that was written by anyone other than yourself. If I have evidence that you have shared program code or used code found anywhere, your grade will be zero.
- If you do discuss the problem and how to solve it with others, you must document that in the program code.
- Not following these rules is in violation of the Student Honor Code and instances of such violations will be reported to the Honor Board.
All identifiers should be meaningful.
Include your design (pseudocode) as comments in your program.
The following comments should appear in your program as the first lines in the file. Items in angle brackets are either to be removed or replaced with what is specified within the brackets:
## Name: <your name goes here – first and last minimum>
## Problem: <Brief, one or two sentence description of the
## problem that this program solves, in your own
## 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
## discussed it with: <Name(s)>