What is the output of the following Python code snippet?
try:
int('x')
except (TypeError, ValueError):
print('caught')
int('x')
except (TypeError, ValueError):
print('caught')
Correct answer
C. caught
6 views
C. caught
6 views
except can catch multiple types using a tuple.
Asked in: Python Interview Exception Handling
https://docs.python.org/3/tutorial/errors.htmlNot sure why the answer is C? Ask here and get an explanation.