← Quiz: Python Decorators: all 10 questions
Quiz: Python Decorators · Question 3 of 10
What does this print? (code)
What does this print?
def deco(f):
def w():
return f() * 2
return w
@deco
def five():
return 5
print(five())
- A.5
- B.10
- C.25
- D.None
Answer & explanation
Correct answer: 10
five now refers to w, which calls the original five and doubles the result.
Can you get the rest right without peeking?
Take the timed Quiz: Python Decorators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →