PIXELBANKv8.2.1
Menu

Decorator Implementation

Problem Statement

Implement a simple function decorator.

Background

Decorators wrap functions to add behavior:

@decorator
def func():
    pass
# Equivalent to: func = decorator(func)

Your Task

Write a decorator call_counter that counts how many times a function is called.

The decorated function should have an attribute call_count that tracks the count.

Output Format

The decorated function should work normally but have a call_count attribute.

Example:

Input:
Call greet twice
Output:
call_count = 2
Reasoning:

Each call increments the counter stored on the wrapper function

Constraints:

  • Preserve the original function's behavior
  • Add call_count attribute to the wrapper
Editor

Test Results

0/0
Run code to see test results.