Home / Challenges / Build a Logging Decorator

Build a Logging Decorator

Hard
Write a decorator called log_call that prints "Calling <function_name>" before the decorated function runs, and "Finished <function_name>" after it returns. Apply it to a function greet(name) that returns f"Hello, {name}!".

Input

No direct input — call the decorated greet("Alice").

Output

Printed log messages plus the function's return value.

Example

Input
greet("Alice")
Output
Calling greet
Finished greet
Hello, Alice!
20 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.