Skip to content

Commit 0f2a388

Browse files
committed
fixing stuff
1 parent f6d5ba2 commit 0f2a388

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

exceptions.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ That works.
1313

1414
```
1515
Enter a number: 3
16-
Your number twice: 6
16+
Your number doubled: 6
1717
```
1818

1919
But that doesn't work if the user does not enter a number.
@@ -103,20 +103,6 @@ TypeError: unsupported operand type(s) for +: 'int' and 'str'
103103
>>>
104104
```
105105

106-
Catching ValueError doesn't catch TypeErrors.
107-
108-
```py
109-
>>> try:
110-
... 123 + 'hello'
111-
... except ValueError:
112-
... print("wrong value")
113-
...
114-
Traceback (most recent call last):
115-
File "<stdin>", line 2, in <module>
116-
TypeError: unsupported operand type(s) for +: 'int' and 'str'
117-
>>>
118-
```
119-
120106
Exceptions always interrupt the code even if we catch them. Here the
121107
print never runs because it's after the error but inside the `try`
122108
block. Everything after the try block runs normally.
@@ -171,7 +157,8 @@ wrong type
171157

172158
Seems to be working.
173159

174-
We can catch multiple exceptions by catching a tuple of exceptions:
160+
We can also also catch multiple exceptions by catching
161+
[a tuple](lists-and-tuples.md#tuples) of exceptions:
175162

176163
```py
177164
>>> try:

0 commit comments

Comments
 (0)