Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e09133

Browse files
committed
Corrections
1 parent 8285625 commit 0e09133

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

book/book.tex

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8454,7 +8454,7 @@ \section{Exercises}
84548454
\index{birthday paradox}
84558455
84568456
If there are 23 students in your class, what are the chances
8457-
that two of you have the same birthday? You can estimate this
8457+
that two of them have the same birthday? You can estimate this
84588458
probability by generating random samples of 23 birthdays
84598459
and checking for matches. Hint: you can generate random birthdays
84608460
with the {\tt randint} function in the {\tt random} module.
@@ -11520,15 +11520,16 @@ \section{Catching exceptions}
1152011520
1152111521
A lot of things can go wrong when you try to read and write
1152211522
files. If you try to open a file that doesn't exist, you get an
11523-
{\tt IOError}:
11523+
{\tt FileNotFoundError}:
1152411524
\index{open function}
1152511525
\index{function!open}
11526-
\index{exception!IOError}
11527-
\index{IOError}
11526+
\index{exception!FileNotFoundError}
11527+
\index{FileNotFoundError}
1152811528
1152911529
\begin{verbatim}
1153011530
>>> fin = open('bad_file')
11531-
IOError: [Errno 2] No such file or directory: 'bad_file'
11531+
FileNotFoundError: [Errno 2] No such file or directory: 'bad_file'
11532+
1153211533
\end{verbatim}
1153311534
%
1153411535
If you don't have permission to access a file:
@@ -11645,7 +11646,7 @@ \section{Databases}
1164511646
\index{dictionary methods!dbm module}
1164611647
1164711648
\begin{verbatim}
11648-
for key in db:
11649+
for key in db.keys():
1164911650
print(key, db[key])
1165011651
\end{verbatim}
1165111652
%
@@ -13094,7 +13095,7 @@ \section{Glossary}
1309413095
execution of a program.
1309513096
\index{invariant}
1309613097
13097-
\item[assert statement:] A statement that check a condition and raises
13098+
\item[assert statement:] A statement that checks a condition and raises
1309813099
an exception if it fails.
1309913100
\index{assert statement}
1310013101
\index{statement!assert}

0 commit comments

Comments
 (0)