1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Functions in Python

Connected

Exercise

Defining a decorator

Your buddy has been working on a decorator that prints a "before" message before the decorated function is called and prints an "after" message after the decorated function is called. They are having trouble remembering how wrapping the decorated function is supposed to work. Help them out by finishing their print_before_and_after() decorator.

Instructions

100 XP
  • Call the function being decorated and pass it the positional arguments *args.
  • Return the new decorated function.