1"""
2Solution to challenge 1 from Introduction to Python course at FMI
3by Nikolay Nikolaev.
4"""
5
6
7def type_decorator(func):
8 """Modifies list according to type of values."""
9
10 def contra(n):
11 result = []
12 for x in n:
13 if isinstance(x, bool):
14 result.append(not x)
15 elif isinstance(x, (int, float)):
16 result.append(-x)
17 elif isinstance(x, str):
18 result.append(x[::-1])
19 return func(result)
20
21 return contra
22
23
24@type_decorator
25def no_it_isnt(vals):
26 """Return list in reverse order."""
27 return vals[::-1]
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
18.10.2023 11:35