### First Printing Errata (January 12, 2012)

Chapter 1

Page 5, line -4, change hasn't to has.

Page 10, line -9, change 3.1415 to 3.14159.

Chapter 2

Page 38, in the second blue box, delete "not".

Page 58, Exercise 2.13, change the input number 3125 to 5213.

Chapter 3

Page 66, line -15, change ComuteLoan.cpp to ComputeLoan.cpp.

Page 67, Insert a note before Check Point Question 3.1. Note that the (x2 - x3) * (x2 - x3) can be simplified using (x2 - x3) ** 2 and round(A * 100) / 100.0 can be simplified using round(A, 2).

Page 70, line -3, change 2 * radius to 2 * radius * math.pi.

Page 74, line 3 in the Caution box, change 1003.9999999999999 to 1002.9999999999999.

Page 77, line -5, change 123456782.92 to 12345678.92.

Page 86, the formula in line 1 should be Area = 5 * s * s / (4 * tan(pi/5)) and change 108.81 in the output for Programming Exercise 3.1 to 71.92.

Page 86, in Exercise 3.2, change arccos to acos.

Page 86, in the sample output for Exercise 3.4, change 53.0 to 52.0.

Page 87, in the sample output for Exercise 3.5, change 73.69 to 72.69.

Chapter 4

Page 92, two lines before Table 4.1, change "which an be" to "which can be".

Page 94, line -14, change line 12 to line 13.

Page 102, line 1, delete the word respectively.

Page 102, Add a colon after else in the Checkpoint question 4.10.

Page 104, last line, delete the entire hint.

Page 108, second line in the first paragraph, change Section 2.6 to Section 2.7.

Page 111, Table 4.6, change p1 and p2 to p1 or p2.

Page 112, in the paragraph right below the output box, change 2 and 4 to 2 and 3 and change 2 or 4 to 2 or 3. Change (number % 2 == 0 and number % 3 == 0) and not (number % 2 == 0 and number % 3 == 0) to (number % 2 == 0 or number % 3 == 0) and not (number % 2 == 0 and number % 3 == 0).

Page 117, line 2 after Table 4.7, add "except assignment operators" after "All binary operaotrs".

Page 122, Exercise 4.9, the output should be "Package 2 has the better price."

Chapter 5

Page 145, line 3 in Listing 5.6, delete the | symbol.

Page 159, in Exercise 5.4, change 15.481 to 14.481.

Page 159, in Exercise 5.5, delete "and that 1 pound is .45 kilograms." Change the last number from 235.09 to 234.09.

Page 159, in Exercise 5.6, delete "and that 1 kilometer is .621 miles."

Page 159, in Exercise 5.6, change 15.481 to 14.481.

Page 160, in Exercise 5.8, change 5.2426 to 4.2426 and change 5.4721 to 4.4721.

Page 161, in Exercise 5.20, change Pattern D as shown below:

```1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
```

Page 164, in Exercise 5.33, change 10145.43 to 10144.44.

Chapter 6

Page 179, in Check Point Question 6.9, change (51, 6) to min(51, 6).

Page 205, in Exercise 6.9, change 26.0 to 25.0 and 66.0 to 65.0.

Page 195, in line -4 and line -5, change getMonthBody to printMonthBody.

Page 199, in the middle of the page, change getNumberOfDasInMonth to getNumberOfDaysInMonth.

Chapter 8

Page 249, s.rfind("o") should return 15 rather than 17.

Chapter 10

Page 315, In Table 10.1 title, the space between Sequence and s should be removed.

Page 318, In the second example box, line 5, change [3, 5] to [5, 2].

Page 319, Section 10.2.8, line 8 and 10 should True and line 12 and 14 should be False.

Page 353, in the sample run box for Exercise 10.19, change 7 to 8.

Chapter 12

Page 411, line -2 and -3, change display to displayObject.

Page 419, in Figure 12.5, change 5..6 to 5..60.

Chapter 13

Page 441, in Figure 13.1, change [number.int) to [number: int].

Chapter 14

Page 477, remove the last line in the output box. The last line is False.

`	`

Credits:

Yenumula Reddy (Grambling State University), Patrick Wijntjes (The Netherlands), Kasun Abeykoon (St. Cloud State University), Gene Boggess (Mississippi State University), Nelson Max (UC Davis), John Curtis (Utica College), Charles Doest (Netherlands), Dimitri Chaccour, Sharon Harvey (Normandale Community College), Jinyong Liang (Petro China).

Please send errata to y.daniel.liang@gmail.com. Thanks for helping improve the book!