1def no_it_isnt(yes_it_is):
2 argument = []
3 for element in yes_it_is:
4 if type(element) in (int, float):
5 argument.append(-element)
6 elif type(element) is str:
7 argument.append(element[::-1])
8 elif type(element) is bool:
9 argument.append(not element)
10
11 return argument[::-1]
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
Лилия Костадинова
19.10.2023 09:52Отказвам се да бъда креативна, опасно е. 😄 Отново благодаря за бързата обратна връзка.
|
f | 1 | def no_it_isnt(yes_it_is): | f | 1 | def no_it_isnt(yes_it_is): |
2 | argument = [] | 2 | argument = [] | ||
3 | for element in yes_it_is: | 3 | for element in yes_it_is: | ||
n | 4 | if type(element) is int or type(element) is float: | n | 4 | if type(element) in (int, float): |
5 | argument.append(-element) | 5 | argument.append(-element) | ||
6 | elif type(element) is str: | 6 | elif type(element) is str: | ||
7 | argument.append(element[::-1]) | 7 | argument.append(element[::-1]) | ||
8 | elif type(element) is bool: | 8 | elif type(element) is bool: | ||
t | 9 | argument.append(False if element else True) | t | 9 | argument.append(not element) |
10 | 10 | ||||
11 | return argument[::-1] | 11 | return argument[::-1] |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|