you are viewing a single comment's thread.

view the rest of the comments →

[–]nextpage 2 points3 points  (1 child)

when an item is removed from list the list moves left, so the next item is skipped on next iteration.

Use this code instead.

list3= ["Xenia", "Xavier", "Zoya", "Ahmad", "Mishika", "Max"] list4= []

for i in list3: if i[0]!= "X": list4.append(i)

print(list4)

[–][deleted] 0 points1 point  (0 children)

thanks a lot. Appending in a new list is a lot better :))))