HomeTracks
Explorer···
THEEBUG
Completed0/9
Score0
PYlesson9.py×
THEEBUGlesson9.py
1
def parse_number(text):
2
try:
3
return int(text)
4
______ ______:
5
return None
6
 
7
print(parse_number("42")) # 42
8
print(parse_number("invalid")) # None
$[system] Theebug ready. Happy coding!
Code BlocksDrag blocks into the drop zones above
8 blocks available
except
catch
error
finally
ValueError
TypeError
KeyError
Exception
Game Panel
0:000 pts
Level 9 of 9Error Handling
0/2 slots correct
Objective
Complete the try/except keyword AND name the specific exception type so a parsing failure returns None instead of crashing
Expected Output
42
None
Debug says:
Two blanks this time! First: which keyword catches an error if it raises? Second: int("invalid") raises a specific kind of error — which one?
Debug the Worm