Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed May 14, 2021
1 parent 8285625 commit 0e09133
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions book/book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8454,7 +8454,7 @@ \section{Exercises}
\index{birthday paradox}
If there are 23 students in your class, what are the chances
that two of you have the same birthday? You can estimate this
that two of them have the same birthday? You can estimate this
probability by generating random samples of 23 birthdays
and checking for matches. Hint: you can generate random birthdays
with the {\tt randint} function in the {\tt random} module.
Expand Down Expand Up @@ -11520,15 +11520,16 @@ \section{Catching exceptions}
A lot of things can go wrong when you try to read and write
files. If you try to open a file that doesn't exist, you get an
{\tt IOError}:
{\tt FileNotFoundError}:
\index{open function}
\index{function!open}
\index{exception!IOError}
\index{IOError}
\index{exception!FileNotFoundError}
\index{FileNotFoundError}
\begin{verbatim}
>>> fin = open('bad_file')
IOError: [Errno 2] No such file or directory: 'bad_file'
FileNotFoundError: [Errno 2] No such file or directory: 'bad_file'
\end{verbatim}
%
If you don't have permission to access a file:
Expand Down Expand Up @@ -11645,7 +11646,7 @@ \section{Databases}
\index{dictionary methods!dbm module}
\begin{verbatim}
for key in db:
for key in db.keys():
print(key, db[key])
\end{verbatim}
%
Expand Down Expand Up @@ -13094,7 +13095,7 @@ \section{Glossary}
execution of a program.
\index{invariant}
\item[assert statement:] A statement that check a condition and raises
\item[assert statement:] A statement that checks a condition and raises
an exception if it fails.
\index{assert statement}
\index{statement!assert}
Expand Down

0 comments on commit 0e09133

Please sign in to comment.