Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What purpose does a parameterized decorator serve?
Think of how you might change a function's action based on different inputs.
Give an example of a scenario where a parameterized decorator would be useful.
Consider cases where repetitive action may be needed.
What is a parameterized decorator?
Think about how parameters change the behavior of functions.
True or False: A parameterized decorator can only have one parameter.
Think about functions; can they have multiple inputs?
Create a parameterized decorator called timing that measures and prints the time taken to execute a function.
How can you measure the start and end time around the function call?
Write a parameterized decorator that adds a custom greeting to the output of any function it wraps.
What do you need to append to the function's output?
5 more questions in this section. Enroll free to practise them all.
Enroll free