1def no_it_isnt(input_list):
2 result = []
3 for value in input_list[::-1]:
4 if isinstance(value, bool):
5 result.append(not value)
6 elif isinstance(value, int) or isinstance(value, float):
7 result.append(-value)
8 elif isinstance(value, str):
9 result.append(value[::-1])
10 else:
11 result.append(value)
12 return result
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def no_it_isnt(input_list): | f | 1 | def no_it_isnt(input_list): |
n | 2 | copy_list = input_list[:] | n | ||
3 | result = [] | 2 | result = [] | ||
t | 4 | for value in copy_list[::-1]: | t | 3 | for value in input_list[::-1]: |
5 | if isinstance(value, bool): | 4 | if isinstance(value, bool): | ||
6 | result.append(not value) | 5 | result.append(not value) | ||
7 | elif isinstance(value, int) or isinstance(value, float): | 6 | elif isinstance(value, int) or isinstance(value, float): | ||
8 | result.append(-value) | 7 | result.append(-value) | ||
9 | elif isinstance(value, str): | 8 | elif isinstance(value, str): | ||
10 | result.append(value[::-1]) | 9 | result.append(value[::-1]) | ||
11 | else: | 10 | else: | ||
12 | result.append(value) | 11 | result.append(value) | ||
13 | return result | 12 | return result |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|