🎙 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 2 of 10

@timer above def load(): is the same as which line?

@timer above def load(): is the same as which line?

  1. A.load = load(timer)
  2. B.timer(load())
  3. C.load = timer(load)
  4. D.timer = load(timer)
Answer & explanation

Correct answer: load = timer(load)

The function is passed to the decorator, and the result replaces the name.

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 →