1def reverse_value(value):
2 if type(value) in (int, float):
3 return -value
4 if type(value) is bool:
5 return not value
6 if type(value) is str:
7 return value[::-1]
8
9
10def no_it_isnt(values):
11 return list(map(reverse_value, values[::-1]))
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def reverse_value(value): | f | 1 | def reverse_value(value): |
n | 2 | if (type(value) in (int, float)): | n | 2 | if type(value) in (int, float): |
3 | return -value | 3 | return -value | ||
n | 4 | if (type(value) is bool): | n | 4 | if type(value) is bool: |
5 | return not value | 5 | return not value | ||
n | 6 | if (type(value) is str): | n | 6 | if type(value) is str: |
7 | return value[::-1] | 7 | return value[::-1] | ||
8 | 8 | ||||
9 | 9 | ||||
10 | def no_it_isnt(values): | 10 | def no_it_isnt(values): | ||
t | 11 | return list(map(reverse_value, values[::-1])) | t | 11 | return list(map(reverse_value, values[::-1])) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
f | 1 | def reverse_value(value): | f | 1 | def reverse_value(value): |
2 | if (type(value) in (int, float)): | 2 | if (type(value) in (int, float)): | ||
3 | return -value | 3 | return -value | ||
4 | if (type(value) is bool): | 4 | if (type(value) is bool): | ||
5 | return not value | 5 | return not value | ||
6 | if (type(value) is str): | 6 | if (type(value) is str): | ||
7 | return value[::-1] | 7 | return value[::-1] | ||
8 | 8 | ||||
9 | 9 | ||||
10 | def no_it_isnt(values): | 10 | def no_it_isnt(values): | ||
11 | return list(map(reverse_value, values[::-1])) | 11 | return list(map(reverse_value, values[::-1])) | ||
t | 12 | t | |||
13 | |||||
14 | print(no_it_isnt([1, -3.14, True, 'abc', 0])) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|