Thursday, January 29, 2009

Chapter 2 -- Page 78 -- Listing 2.6

The variable numdarts in line 5 and line 23 should be numDarts (camelcase).

2 comments:

  1. 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

    ReplyDelete
  2. I fixed it modifying this line of code:

    pi = float(inCircle)/numDarts * 4.0

    ReplyDelete