Back to Lesson
Multiple Exceptions
Write a block with multiple exception handlers.
Instructions
- Given.
data = {"a": "hello"} - Inside a try block, try to accessand cast it to an
data["b"]on one line:int().num = int(data["b"]) - Add an except block forthat prints
KeyError."Key missing" - Add an except block forthat prints
ValueError."Not a number"
main.py
main.py
Ctrl + Enter