+ 2

Can't iterate throught a list using for loop in python.

I don't know why it's not working. the list doesn't change. alist = [1, 2, 5, 6, 8, 15, 16] for i in alist: if i%2==0: i += 1 print(alist) if i_am_doing_something_wrong: HelpMe("Please") :)

19th Sep 2017, 5:27 PM
Damon Keane
2 Answers
+ 4
I hope you meant to do this... if not tell me and I'll help😁 https://code.sololearn.com/cRNdMe75rz3n/?ref=app
19th Sep 2017, 5:58 PM
Tim Thuma
Tim Thuma - avatar
+ 4
it works!! thank you!
19th Sep 2017, 5:59 PM
Damon Keane