1def no_it_isnt(items):
2 result = []
3 for item in items:
4 if isinstance(item, bool):
5 result.insert(0, bool(item ^ 1))
6 elif isinstance(item, str):
7 result.insert(0, item[::-1])
8 else:
9 result.insert(0, -item)
10 return result
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def no_it_isnt(items): | f | 1 | def no_it_isnt(items): |
n | 2 | for index in range(len(items)): | n | 2 | result = [] |
3 | for item in items: | ||||
3 | if(isinstance(items[index], bool)): | 4 | if isinstance(item, bool): | ||
4 | items[index] = bool(items[index] ^ 1) | 5 | result.insert(0, bool(item ^ 1)) | ||
5 | elif(isinstance(items[index], int) or isinstance(items[index], float)): | 6 | elif isinstance(item, str): | ||
6 | items[index] = -items[index] | 7 | result.insert(0, item[::-1]) | ||
7 | else: | 8 | else: | ||
t | 8 | items[index] = items[index][::-1] | t | 9 | result.insert(0, -item) |
9 | items.reverse() | 10 | return result | ||
10 | return items | ||||
11 | |||||
12 | |||||
13 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|