HW problem: "Create a list called some_list from -100 to 0 and then replace every even number with its positive value"
I tried the following code, but it's giving me a NoneType error, saying "'NoneType' object has no attribute 'append'" which leads me to guess that one of the answers in this loops produces a None, which I'm not sure exactly how that is happening...
some_list = []
for i in range(10):
if i % 2 == 0:
i = abs(i)
some_list = some_list.append(i)
elif i % 2 == 1:
some_list = some_list.append(i)
else:
pass
some_list
I want to call some_list and get back the following:
print(some_list)
[100,-99,98,-97,96,...,0]
Many thanks!