16
What is the output of the following code?
try:
print(10 / 0)
except ZeroDivisionError:
print('error')DiscussEasy
Loading subject content…
Loading practice questions…
What is the output of the following code?
try:
print(10 / 0)
except ZeroDivisionError:
print('error')What is the output of the following code?
def g():
try:
raise KeyError
except KeyError:
return 'handled'
finally:
print('cleanup', end=' ')
print(g())What is the output of the following code?
try:
try:
{}['k']
except KeyError:
raise ValueError('wrapped')
except ValueError as e:
print(e, type(e.__context__).__name__)What is the output of the following code?
try:
1 / 0
except ZeroDivisionError:
print('zero')What is the output of the following code?
try:
x = int('abc')
except ValueError:
x = -1
print(x)