What this snippet does
Multiple exception types can be caught in a single block, with the instance bound to the 'as' variable.
Expected output
Error: invalid literal for int() with base 10: 'abc' 0
Why practise typing this
Typing error handling code builds muscle memory for the symbols and indentation Python uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.
More Python practice
- Basic TryError Handling · beginner
- Broad ExceptionError Handling · beginner
- Basic Custom ErrorError Handling · intermediate
- Validation ErrorError Handling · intermediate
- Base ExceptionError Handling · intermediate
- Dynamic TypingVariables & Types · beginner