File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ That works.
1313
1414```
1515Enter a number: 3
16- Your number twice : 6
16+ Your number doubled : 6
1717```
1818
1919But 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-
120106Exceptions always interrupt the code even if we catch them. Here the
121107print never runs because it' s after the error but inside the `try`
122108block. Everything after the try block runs normally.
@@ -171,7 +157,8 @@ wrong type
171157
172158Seems 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 :
You can’t perform that action at this time.
0 commit comments