Александр Махов [528] FixFloat 12854
Руденко Диана Алексеевна 528 FixFloat 12764
n1def fix(n):n1def fix(n: int):
22
n3    def decorator(fn):n3    def decorator(fun):
44
n5        def wrapper(*args, **kwargs):n5        def fix_fun(*args, **kwargs):
6            n_arg = []6            new_args = []
7            for i in args:7            for arg in args:
8                if isinstance(i, float):8                if isinstance(arg, float):
9                    n_arg.append(round(i, n))9                    new_args.append(round(arg, n))
10                else:10                else:
n11                    n_arg.append(i)n11                    new_args.append(arg)
12            for (jk) in kwargs.items():12            for (keyvalue) in kwargs.items():
13                if isinstance(k, float):13                if isinstance(value, float):
14                    kwargs[j] = round(k, n)14                    kwargs[key] = round(value, n)
15            res = fn(*n_arg, **kwargs)15            result = fun(*new_args, **kwargs)
16            if isinstance(res, float):16            if isinstance(result, float):
17                return round(res, n)17                return round(result, n)
18            else:18            else:
t19                return rest19                return result
20        return wrapper20        return fix_fun
21    return decorator21    return decorator
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op