practicepython.in
python exercises
171 exercises

Daily #19 · 17 October 2026

Two returns Hard

What does this print?

def answer():
    try:
        return "try"
    finally:
        return "finally"

print(answer())
  1. Atry
  2. Bfinally
  3. Ctry finally
  4. DNone
Show the answer

B: finally

Why: finally always runs, even on the way out of a return, and a return inside it replaces the one already in flight. Newer Pythons warn about exactly this, because it also swallows exceptions.

Play today’s puzzle →