UTF-8
Errata: March 8, 2021

Thank you for purchasing Python Workout. Please post errata not listed below in this book's LiveBook Errata thread. Corrections are made to all formats during the book's second printing. Thank you!



Page 25

The second parenthetical in the following sentence should be (""), as shown below.
This time, we don’t join the letters together with a space character (' '), but rather with an empty string ("").

Page 60

The sentence, It’s pretty standard to use dicts to keep track of accumulated values (such as the number of times something has happened, or amounts of money) associated with arbitrary values.
should be
It’s pretty standard to use dicts to keep track of accumulated values (such as the number of times something has happened, or amounts of money) associated with arbitrary keys.

Page 85

In the sentence, As noted, your function should return a dict in which the dict’s keys are the filenames and the dict’s values are the longest words in each file, word should be singular,
should be:
As noted, your function should return a dict in which the dict’s keys are the filenames and the dict’s values are the longest word in each file.

Page 93

In the phrase, calling them subject (for the name of the class), change class to subject, as shown below:
...calling them subject (for the name of the subject)

Page 126

Delete the following sentence: Finally, we print the sum using an f-string.

Page 136

The sentence, If the words file contains one word per line, then iterating over the lines of the file really means iterating over the different line,
should be:
If the words file contains one word per line, then iterating over the lines of the file really means iterating over the different words.

Page 149

The sentence, Finally, the calculate_tax function takes three parameters—the amount of the sale, the name of the province in which the sale took place, and the hour at which the sale happened—and returns a floating-point number indicating the actual, current tax rate,
should be:
Finally, the calculate_tax function takes three parameters—the amount of the sale, the name of the province in which the sale took place, and the hour at which the sale happened—and returns the total cost, including the original amount and the tax on that amount..

Page 170

Scoops, in the following sentence should be new_scoops, as shown:
We can then iterate over each element of new_scoops, adding it to the self.scoops attribute.

The word flavors in the following sentence, should be scoops, as shown below:
Our __repr__ method does little more than invoke str.join on the strings that we extract from the scoops.

Page 173

List[int} in the following sentence should be List[Scoop]. as shown below:
Notice that the type that we provide, List[Scoop], has a capital “L”. This means that it’s distinct from the built-in list type.

Page 181

Remove the space in Bowl.max_scoops, as shown below:
In our previous version of Bowl.add_scoops, we said that we wanted to use Bowl.max_scoops to keep track of the maximum number of scoops allowed.

The use of iCPO in the following sentence should use an uppercase I, as shown below:
By the ICPO lookup rule, Python will first look on the instance, and then on the class, which is BigBowl in this case, and return BigBowl.max_scoops, with a value of 5.

Page 188

The use of ABC-Meta in the following sentence should be ABCMeta, as shown below:
If you really want, you can import ABCMeta. Simply remove the hyphen.

In the following phrase, the word or should be of, as shown below:
...think that it’s enough to document a class as being abstract, without the overhead of language enforcement.