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