Outline for January 29, 2018
Reading
: §4.4
Unformatted and formatted printing [
printing.py
]
Calculating π using a Monte Carlo method
How you do it
random
module
Building program in modules, including testing routines
First step: computing co-ordinates of dart toss [
mc1.py
]
Second step: see if a point falls within the unit circle [
mc2.py
]
Third step: read in a positive integer, with error checking [
mc3.py
]
Fourth step: put it all together and print the results [
mc4.py
]
Matt Bishop
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562 USA
Last modified: Version of January 28, 2018 at 11:16PM
Winter Quarter 2018
You can get a PDF version of this