I am writing a program in Python and am trying to increment numbers in a list based on certain criteria. My code looks like this:
for i in list1:
if i+.1 in list2:
i+=.1
elif i+.2 in list2:
i+=.2
else:
i = i
However this is not adding anything to i, even if the condition is true. How can I do this? I know list comprehensions, but don't see how that could work in this case.