1def get_oposite(arg):
2 if type(arg) is int or type(arg) is float:
3 return arg * -1
4 if type(arg) is bool:
5 return not arg
6 if type(arg) is str:
7 return arg[::-1]
8
9
10def no_it_isnt(original):
11 result = []
12 for arg in original[::-1]:
13 result.append(get_oposite(arg))
14 return result
.....
----------------------------------------------------------------------
Ran 5 tests in 0.000s
OK
f | 1 | def get_oposite(arg): | f | 1 | def get_oposite(arg): |
n | 2 | if(type(arg) is int or type(arg) is float): | n | 2 | if type(arg) is int or type(arg) is float: |
3 | return arg * -1 | 3 | return arg * -1 | ||
n | 4 | if(type(arg) is bool): | n | 4 | if type(arg) is bool: |
5 | return not arg | 5 | return not arg | ||
n | 6 | if(type(arg) is str): | n | 6 | if type(arg) is str: |
7 | return arg[::-1] | 7 | return arg[::-1] | ||
8 | 8 | ||||
9 | 9 | ||||
10 | def no_it_isnt(original): | 10 | def no_it_isnt(original): | ||
11 | result = [] | 11 | result = [] | ||
12 | for arg in original[::-1]: | 12 | for arg in original[::-1]: | ||
13 | result.append(get_oposite(arg)) | 13 | result.append(get_oposite(arg)) | ||
14 | return result | 14 | return result | ||
t | 15 | t | |||
16 | print(no_it_isnt([1, -3.14, True, 'abc', 0])) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|