← Quiz: Exceptions and Files: all 15 questions
Quiz: Exceptions and Files · Question 6 of 15
What does this print? (code)
What does this print?
try:
print(1 / 0)
except ZeroDivisionError:
print("div")
else:
print("else")
- A.div
- B.else
- C.div else
- D.An error
Answer & explanation
Correct answer: div
else runs only if there was no exception.
Can you get the rest right without peeking?
Take the timed Quiz: Exceptions and Files quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →