← Quiz: Python Decorators: all 10 questions
Quiz: Python Decorators · Question 4 of 10
What does this print? (code)
What does this print?
def deco(f):
def w():
f()
return w
@deco
def get():
return 7
print(get())
- A.7
- B.0
- C.An error
- D.None
Answer & explanation
Correct answer: None
The wrapper calls f() but does not return its result, so it returns None.
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 →