Advertisement
Kamend1

Logger exercise - Doesn't work in Judge

Mar 20th, 2024
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. def logged(function):
  2.  
  3.     def wrapper(*args):
  4.         result = function(*args)
  5.         log_result = f"you called {function.__name__}({", ".join(map(str, args))})\nit returned {result}"
  6.         return log_result
  7.  
  8.     return wrapper
  9.  
  10. @logged
  11. def func(*args):
  12.     return 3 + len(args)
  13. print(func(4, 4, 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement