1def no_it_isnt(expressions):
2 rejecting = []
3 for item in expressions:
4 if type(item) in (int, float):
5 item = -item
6 elif type(item) is bool:
7 item = not item
8 elif type(item) is str:
9 item = item[::-1]
10 rejecting.append(item)
11 return rejecting[::-1]
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
| t | 1 | def no_it_isnt(lst): | t | 1 | def no_it_isnt(expressions): |
| 2 | rejecting=[] | 2 | rejecting = [] | ||
| 3 | for i in lst: | 3 | for item in expressions: | ||
| 4 | if type(i) in (int, float): | 4 | if type(item) in (int, float): | ||
| 5 | i = -i | 5 | item = -item | ||
| 6 | elif type(i) is bool: | 6 | elif type(item) is bool: | ||
| 7 | i = not i | 7 | item = not item | ||
| 8 | elif type(i) is str: | 8 | elif type(item) is str: | ||
| 9 | i = i[::-1] | 9 | item = item[::-1] | ||
| 10 | rejecting.append(i) | 10 | rejecting.append(item) | ||
| 11 | return rejecting[::-1] | 11 | return rejecting[::-1] |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||
| f | 1 | def no_it_isnt(lst): | f | 1 | def no_it_isnt(lst): |
| t | 2 | for i in range(0, len(lst)): | t | 2 | rejecting=[] |
| 3 | for i in lst: | ||||
| 3 | if type(lst[i]) in (int, float): | 4 | if type(i) in (int, float): | ||
| 4 | lst[i] = -lst[i] | 5 | i = -i | ||
| 5 | elif type(lst[i]) is bool: | 6 | elif type(i) is bool: | ||
| 6 | lst[i] = not lst[i] | 7 | i = not i | ||
| 7 | elif type(lst[i]) is str: | 8 | elif type(i) is str: | ||
| 8 | lst[i] = lst[i][::-1] | 9 | i = i[::-1] | ||
| 10 | rejecting.append(i) | ||||
| 9 | return lst[::-1] | 11 | return rejecting[::-1] |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||