@@ -8454,7 +8454,7 @@ \section{Exercises}
84548454\index {birthday paradox}
84558455
84568456If 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
84588458probability by generating random samples of 23 birthdays
84598459and checking for matches. Hint: you can generate random birthdays
84608460with the {\tt randint} function in the {\tt random} module.
@@ -11520,15 +11520,16 @@ \section{Catching exceptions}
1152011520
1152111521A lot of things can go wrong when you try to read and write
1152211522files. 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%
1153411535If 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}
1309413095execution 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
1309813099an exception if it fails.
1309913100\index {assert statement}
1310013101\index {statement!assert}
0 commit comments