The last line should be:
print(line)
The previous "Hello World" example produces two string objects, one of which is immediately discarded.
should be:
The previous "Hello World" example produces three string objects, two of which are immediately discarded.
Lines 3 through 5 reference Python 2.7 string constants, which aren't available in Python 3. This line should read:
string.ascii_lowercase
contains all lowercase ASCII alphabetic characters; string.ascii_uppercase
contains all ASCII uppercase alphabetic characters; string.ascii_letters
contains
all the characters in string.ascii_lowercase
and string.ascii_uppercase
.
There's a missing closing parenthesis in the last line of code in the sidebar.
>>> print("a", "b", "c", file=open("testfile.txt", "w")
should be:
>>> print("a", "b", "c", file=open("testfile.txt", "w"))
A block containing a single line may be placed on the same line after the semicolon of a clause of a compound statement:
should read:
A block containing a single line may be placed on the same line after the colon of a clause of a compound statement:
Cueball 4 is misplaced. This cueball should go with the last three lines of code.
The reference to file-input
in the Quick Check table should be fileinput
.
This book focuses on running Windows from a command prompt or PowerShell.
should be:
This book focuses on running Python on Windows from command prompt or PowerShell.
Replace os.path.isdir(os.path.join(path, os.pardir, os.curdir))
with os.path.isabs(os.path.join(os.pardir, path))
.
On most operating systems, this directory includes variables related to paths...
should be:
On most operating systems, this dictionary includes variables related to paths...
Change base to basename in the third line of the following:
os.path.split(path): "Splits the path into a base and tail (the last element of the path)"
os.path.splitext(path): "Splits the path into a base and a file extension"
&
os.path.basename(path): "Gets the basename of the path"
Line 16 of the code has a typo. ModuleNoteFoundError
should be ModuleNotFoundError
.
Inheritance also comes into effect when you attempt to use a method that isn't defined in the base classes but is defined in the superclass.
should read:
Inheritance also comes into effect when you attempt to use a method that isn't defined in the subclass or derived class, but is defined in the superclass.
The 7th line of code from the top should be:
self.__class__.all_circles.append(self)
Instance C's namespace contains...
should be:
Instance c's namespace contains...
The last z in the first line of code should be uppercase.
[-a-zA-z]
should be:
[-a-zA-Z]
To clarify the difference between the two middle boxes in the first level (Superclass class variables) add the following parentheticals, respectively:
The sentence
You'll have noticed that all the directories in your package-mathproj, mathproj/ comp, and mathproj/numeric...
should read
You'll have noticed that all the directories in your package-mathproj, mathproj/ comp, and mathproj/comp/numeric...
In the second paragraph after the code snippet, $where date=between...
should be $where=date between...
.
Toward the bottom of the page, the following sentence has an erroneous ' character at the end of the url: The URL that the request actually sends is https:// data.cityofchicago.org/resource/6zsd-86xi.json?$where=date%20between%20% 222015-01-10T12:00:00%22%20and%20%222015-01-10T14:00:00%22'.
Delete the ' at the end.
The sentence "Create a Table object called data, giving the table's name in the database..." should read "Create a Table object called people, giving the table's name in the database...".
In the middle of the first paragraph in section 24.2.2 Executing code in a cell, the instructions "...click the Run button immediately to the left of the down arrow on the button bar..." are incorrect. The button is to the right of the drop down arrow.
In the first sentence of the third paragraph the word tabular is misspelled (tablular).
The line "If we look at section VII of the readme.txt file we can see that the format of the inventory file is:" should be normal body font, not code font.
There's a note that the following url is empty: http://barry.warsaw.us/software/STYLEGUIDE.txt. When the book went to press, this was true. The url is no longer empty.
There's an erroneous s in the following line:
len([[1, 3, [4, 5], 6], 7 s]) - 2
it should be:
len([[1, 3, [4, 5], 6], 7]) - 2
The Try This solution at the top of the page is missing the neutral option:
if x < -5:
print("very low")
elif x < 0:
print("low")
elif x == 0: # could be 'elif not x:' but the point here is comparison to 0
print("neutral")
elif x <= 5:
print("high")
else:
print("very high")
There's no answer to QUICK CHECK: CONTEXT MANAGERS. D is the correct answer. Please insert "Answer" followed by "D is the balance between too many and too few."