f | def fix(n): | f | def fix(n): |
| | | |
n | def decorator(func): | n | def dec(fun): |
| | | |
n | def new_func(*args, **kwargs): | n | def newfun(*args, **kw): |
| args = list(args) | | args = list(args) |
| for i in range(len(args)): | | for i in range(len(args)): |
| if isinstance(args[i], float): | | if isinstance(args[i], float): |
| args[i] = round(args[i], n) | | args[i] = round(args[i], n) |
t | for var in kwargs: | t | for i in kw: |
| if isinstance(kwargs[var], float): | | if isinstance(kw[i], float): |
| kwargs[var] = round(kwargs[var], n) | | kw[i] = round(kw[i], n) |
| ans = func(*args, **kwargs) | | a = fun(*args, **kw) |
| if isinstance(ans, float): | | if isinstance(a, float): |
| ans = round(ans, n) | | a = round(a, n) |
| return ans | | return a |
| return new_func | | return newfun |
| return decorator | | return dec |