🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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())
  1. A.7
  2. B.0
  3. C.An error
  4. 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 →