1def no_it_isnt(data):
2 end_data = []
3 for i in reversed(data):
4 if type(i) == bool:
5 end_data.append(not i)
6 elif type(i) == int:
7 end_data.append(-i)
8 elif type(i) == float:
9 end_data.append(-i)
10 elif type(i) == str:
11 end_data.append(i[::-1])
12 return end_data
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def no_it_isnt(data): | f | 1 | def no_it_isnt(data): |
2 | end_data = [] | 2 | end_data = [] | ||
3 | for i in reversed(data): | 3 | for i in reversed(data): | ||
4 | if type(i) == bool: | 4 | if type(i) == bool: | ||
5 | end_data.append(not i) | 5 | end_data.append(not i) | ||
6 | elif type(i) == int: | 6 | elif type(i) == int: | ||
7 | end_data.append(-i) | 7 | end_data.append(-i) | ||
t | 8 | elif type(i) == float and i == 0.0: | t | ||
9 | end_data.append(i) | ||||
10 | elif type(i) == float: | 8 | elif type(i) == float: | ||
11 | end_data.append(-i) | 9 | end_data.append(-i) | ||
12 | elif type(i) == str: | 10 | elif type(i) == str: | ||
13 | end_data.append(i[::-1]) | 11 | end_data.append(i[::-1]) | ||
14 | return end_data | 12 | return end_data |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|