n | def fix(prec): | n | def fix(n): |
| | | |
n | def decorator(fun): | n | def dec(fun): |
| | | |
t | def newfun(*args, **kwargs): | t | def wrapper(*args, **kwargs): |
| args = [round(i, prec) if type(i) is float else i for i in args] | | args = [round(x, n) if type(x) == float else x for x in args] |
| kwargs = {key: round(val, prec) if type(val) is float else val for (key, val) in kwargs.items()} | | kwargs = {key: round(x, n) if type(x) == float else x for (key, x) in kwargs.items()} |
| ans = fun(*args, **kwargs) | | result = fun(*args, **kwargs) |
| return round(ans, prec) if type(ans) is float else ans | | return round(result, n) if type(result) == float else result |
| return newfun | | return wrapper |
| return decorator | | return dec |