Question OOP-EXC-0005
EasyWhat is the output of this code?
try:
print(10 // 0)
except ZeroDivisionError:
print("Cannot divide by zero")
- A.
Infinity
- B.
Cannot divide by zero
- C.
Show answer and explanation
Answer: B
10 // 0 raises ZeroDivisionError, which the except block catches.