Python for Everyone, 1st Edition

Bug Report Page

.

How to Tell which Printing You Have

On the copyright page (facing the first page of the Preface), there is a printing history of the book. The printing history is a row of numbers that—at the 1st printing—looks like this:

10 9 8 7 6 5 4 3 2 1

At each subsequent printing, one number is removed from the end of this row of numbers to indicate which printing of the book you have. For example, the last number in the row of numbers in the 2nd printing is 2, and so on. In the list below, [n] means that an error is fixed in the nth printing.

Page 32 [2]
In the first margin note, change “comptuer” to “computer”
Page 80
In Exercise P2.13, change “a number between 1,000 and 999,999” to “a number between 10,000 and 99,999”.
Page 191/192 [2]
Replace the first code block in section 4.8.4 with
valid = len(string) == 13
position = 0
while valid and position < len(string) :
   if position == 0 :
      valid = string[position] == "(" 
   elif position == 4 :
      valid = string[position] == ")" 
   elif position == 8 : 
      valid = string[position] == "-" 
   else :
      valid = string[position].isdigit()
   position = position + 1

if valid :
   print("The string contains a valid phone number.")
else :
   print("The string does not contain a valid phone number.")
and the second code block with
valid = len(string) == 13
position = 0
while valid and position < len(string) :
   valid = ((position == 0 and string[position] == "(") 
      or (position == 4 and string[position] == ")")
      or (position == 8 and string[position] == "-")
      or (position != 0 and position != 4 and position != 8 
         and string[position].isdigit()))
   position = position + 1
Page 193 [2]
Change tolower to lower and toupper to upper
Page 232 [2]
Add a ) after pyramidVolume(9, 10) and pyramidVolume(0, 10) in Step 6 and in lines 7 and 9 of ch05/pyramids.py
Page 248 [2]
Change def gradeToNumber(String grade) to def gradeToNumber(grade) :
Page 249 [2]
Add a colon after def tensName(number) , i.e. def tensName(number) :
Page 254 [2]
Change ”should to be able to” to “should be able to”
Page 259 [2]
Add a colon after def printTriangle(sideLength), i.e. def printTriangle(sideLength) :
Page 313 [2]
In Self Check 30, change Increment j to Decrement j.
Page 347 [2]
Change “the word circus in the second line of text” to “the word eggs in the third line of text”
Page 349 [2]
Change line = line.rsplit() to line = line.rstrip()
Page 366 [2]
In line 35 of babynames.py, change total >= 0 to total < LIMIT
Page 366 Change the URL http://theory.lcs.mit.edu/~rivest/rsapaper.pdf to http://people.csail.mit.edu/rivest/Rsapaper.pdf
Page 367 [2]
In the last bubble in the Public-Key Encryption figure, change “decypted” to “decrypted”
Page 413 [2]
In the page header, it says 8.2 Sets where it should say 8.1 Sets
Page 414 [2]
In the Computers & Society note, change "expects it to to work" to "expects it to work" and "indepent" to "independent"
Page 450 [2]
In Self Check 6, change __init__ to reset
Page 479 [2]
Change “In contrast, the == operator is used to test equality between two objects. That is, it determines whether the data contained in the objects are equal, not whether two variables refer to the same object. Objects that are equal” to “The is and is not operators do not check whether the data contained in the objects are equal, but whether two variables refer to the same object. Objects that contain the same data”, and change “reg3 will be equal to reg1” to “reg3 will have the same data as reg1

Thanks to Claude Anderson, Anas Salah Eddin, Hideki Sano, Erfan Zahrai, Daniel Zingaro and (your name might go here) for their bug reports and suggestions

Please report any remaining bugs in this edition on the bug report form.