1def no_it_isnt(params):
2 result = []
3 for el in params:
4 if type(el) is bool:
5 result.append(not el)
6 elif type(el) in (int, float):
7 result.append(-1 * el)
8 elif type(el) is str:
9 result.append(el[::-1])
10 return list(reversed(result))
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def no_it_isnt(params): | f | 1 | def no_it_isnt(params): |
2 | result = [] | 2 | result = [] | ||
3 | for el in params: | 3 | for el in params: | ||
4 | if type(el) is bool: | 4 | if type(el) is bool: | ||
5 | result.append(not el) | 5 | result.append(not el) | ||
t | 6 | elif type(el) is int or type(el) is float: | t | 6 | elif type(el) in (int, float): |
7 | result.append(-1 * el) | 7 | result.append(-1 * el) | ||
8 | elif type(el) is str: | 8 | elif type(el) is str: | ||
9 | result.append(el[::-1]) | 9 | result.append(el[::-1]) | ||
10 | return list(reversed(result)) | 10 | return list(reversed(result)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|