Create a configurable calculation and a transparent counting wrapper.

Prototype: make_multiplier(factor) returns a callable accepting one number and returning that number times factor. Separate calls retain independent factors.

Final: count_calls(function) returns a wrapper that accepts positional and keyword arguments, returns the original result, and propagates original exceptions. Expose integer attribute wrapper.calls, initially 0. Increment it before every invocation, including calls that raise. Preserve the wrapped function's __name__, __doc__, and __wrapped__ using functools.wraps. Each wrapper has its own counter. Example: after wrapping abs, calls with -2 and -3 return 2 and 3, and .calls is 2. Thread safety is outside this exercise.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.