I am still a newbie in programming and I need some help I want to substract 9 from numbers bigger then 9 from a list.
ls = [1, 2, 3, 4 ,5, 6, 7, 8, 9]
odd_num = []
for _ in ls[::2]:
odd_num.append(_)
ls.remove(_)
for _ in odd_num:
multip_elem = _ * 2
ls.append(multip_elem)
for _ in ls:
if _ > 9:
substraction = _ - 9
ls.append(substraction)
ls.remove(_)
print(ls)
This is the output
[2, 4, 6, 8, 2, 6, 14, 1, 9]
14 is still in the list but I am pretty sure is bigger then 9 :))