CIT 590/591: Exploring Python--Errata
Fall 2012, David Matuszek

This file will be updated whenever more corrections are found.

Page Correction
4
`Ctrl-D` and `Ctrl-Z` don't work to halt program execution; use `Ctrl-C` instead.
14
 Change: `print "answer is," eval(expr)` To: `print "answer is", eval(expr)`
The comma should be outside the quotes.
31
Missing` : `after` if percent >= 90.0` in the middle of the page.
51
The last four lines of `triType` need to be indented more, so that `elif` and `else` are directly below the first `if.`
60, problem 9
`(a * a)n/2` should be `(a * a)n/2`
65
In the program at the bottom of the page, the word `chapter` accidentally wrapped to the next line. It's part of the comment, so it should be on the previous line.
66
The variable `std` and the function `std` should have different names.
67
There are two problems in the first `join` example. There is an essential period missing (period is an operator), and the result should have spaces between the letters.
 Change: ```' 'join(['x', 'y', 'z']) 'xyz'``` To: ```' '.join(['x', 'y', 'z']) 'x y z' ```
69
Just below the box, the line ``` [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] ```should be
```[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 7, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]```
71, line 3
`[1, 2, 3]` should be `[1, 7, 3]`
101, second program
 Incorrect code : `print line.capwords() ` One possible fix: `print line.title()` Another possible fix: ```import string   # as first line of program print string.capwords(line)```
The methods `title` and `capwords` are called differently, but do almost the same thing.
105
`pickle.dump(f, object)` should be `pickle.dump(object, f)`.
To read from a file, use` 'r'`, not` 'w'`.
After reading or writing any file, remember to close it:` f.close()`.
116
Incorrect results are shown at the top of the page.
 Change: ```>>> print myAccount.getBalance() 200 >>> print newAccount.getBalance() 300``` To: ```>>> print myAccount.getBalance() 300 >>> print newAccount.getBalance() 300```
145
The result of the expression `3 4 2 + *` is `18`, not `24`.
155
Inconsistent capitalization: `aFun()` should be `afun()`, or vice versa.
246
`row(x, y, m)` should be` pow(x, y, m) `