Bill Manaris : Fall 2007 / CSCI 220 Homework 1

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)

Learning Objectives


Write program 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 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,


Email your file as an attachment.

Email subject should be "Assignment #1".

My email address is

(If you do the bonus, submit both programs in the same email, as attachments.)


The following policies are in effect for this assignment:


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>
## <ProgramName>.py
## Problem: <Brief, one or two sentence description of the
##           problem that this program solves, in your own
##           words.>
## 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)>
(Printable View of