← Quiz: Exceptions in Depth: all 10 questions
Quiz: Exceptions in Depth · Question 3 of 10
What does this print? (code)
What does this print?
def f():
try:
return "try"
finally:
print("finally", end=" ")
print(f())
- A.try
- B.try finally
- C.finally try
- D.finally
Answer & explanation
Correct answer: finally try
finally runs just before the function returns, so its print comes first.
Can you get the rest right without peeking?
Take the timed Quiz: Exceptions in Depth quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →