I wonder why the montePi function in page 74, just work once (I tryied it in two different computers). I don't know if it is important, but I started with montePi(1), returned >>> 4, and then, all the values returned are >>> 0
This is the place to find errata and give feedback directly to the authors of the textbook Python Programming in Context.
Nothing drives an author more crazy than to find an error in a listing in his own textbook. However, even after months of testing and several rounds of proofreading bugs still find their way in to the final printed book. We aim to provide warnings and fixes here. Please contact us if you find an error that is not covered on this blog.
I wonder why the montePi function in page 74, just work once (I tryied it in two different computers). I don't know if it is important, but I started with montePi(1), returned >>> 4, and then, all the values returned are >>> 0
ReplyDeleteI fixed it modifying this line of code:
ReplyDeletepi = float(inCircle)/numDarts * 4.0