Write a decorator called call_counter that counts how many times a function is called
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Write a decorator called call_counter that counts how many times a function is called. Add a .count attribute to the wrapper. Decorate a function say_hi() that prints 'hi'. Call it 3 times, then print the count.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.