Question OOP-EXC-0064
HardWhat is the output of this code?
class MyErr(Exception):
pass
r = []
for x in [1, 0, "a"]:
try:
r.append(10 // x)
except (ZeroDivisionError, TypeError) as e:
r.append(type(e).__name__[0])
else:
r.append("ok")
print(r)
- A.
[10, 'ok', 'Z', 'T', 'ok']
- B.
[10, 'ok', 'Z', 'T']
- C.
Sign up free to see the answer and a step-by-step explanation.