LearnPy Hub
← Decorators problems
Medium

Keep a Call Log

Write a decorator logged that appends NAME(args) to a global list log on every call. Decorate add(a, b) and neg(x). Read lines add A B or neg X until END, call them and print each result, then print the log entries one per line.

Input

Lines, then END.

Output

Lines.

Sample 1

Input
add 1 2
neg 5
END
Output
3
-5
add(1, 2)
neg(5)

Sample 2

Input
neg 0
END
Output
0
neg(0)
solution.py
Output appears here
Keep a Call Log · Python practice problem · LearnPy Hub