Name: __________________
Student ID: __________________
In this part of the exam you will be designing and coding a Python program.
The sections of the exam correspond to the sections of a lab writeup.

Problem Statement:

One (very slow) way to calculate the value of pi is to compare the area of the unit quarter-circle with the area of the unit square. We can estimate this by generating random points in the unit square, and counting how many lie within the quarter-circle. The ratio should approximate pi/4 as the number of points increases.

Write a function circle_pi(count, freq) that uses count points to estimate pi, printing out estimates every freq iterations (to show its progress).

Write a testbed program that calls your function, but saves the printed output to a file instead of printing to the screen.

Docstrings are required for your program and your function; comments are not required but may be helpful for partial credit if your code isn't perfect.

Problem Suitability: [2]

Problem Restatement: [3]

Libraries: [2]

Problem Refinement (natural language): [5]

Data Tables: [3]


Sample I/O: [2]

User Manual: [5]

Pseudocode: [10]

Code: [8]