f | def fix(n): | f | def fix(n): |
| | | |
| def dec(fun): | | def dec(fun): |
| | | |
n | def wrapper(*args, **kwargs): | n | def newfun(*args, **kwargs): |
| args = [round(x, n) if type(x) == float else x for x in args] | | new_args = [round(arg, n) if type(arg) == float else arg for arg in args] |
| kwargs = {key: round(x, n) if type(x) == float else x for (key, x) in kwargs.items()} | | new_kwargs = {name: round(val, n) if type(val) == float else val for (name, val) in kwargs.items()} |
| result = fun(*args, **kwargs) | | result = fun(*new_args, **new_kwargs) |
| return round(result, n) if type(result) == float else result | | return round(result, n) if type(result) == float else result |
t | return wrapper | t | return newfun |
| return dec | | return dec |