My current code uses a for loop and I'm trying to remove even numbers from list 3 and odd numbers from list 2. However my problem is, that when the for loop iterates, the item in position 2, moves down to position one after an item is removed, therefore it skips an item and the code doesn't work as intended
list1 = ["roll", "burger", "cheese", "ketchup", "mustard"]
list2 = []
list3 = []
for i in list1:
print(i)
#code to add ten numbers to list2
a = 0
while a < 10:
a = a + 1
userdata = input("Enter a whole number: ")
usernum = int(userdata)
list2.append(usernum)
list3[:0]=list2
print(list3)
for n in list2:
if int(n) % 2 != 0:
list2.remove(n)
print(list2)
for x in list3:
if int(x) % 2 == 0:
list3.remove(x)
print(list3)
How would I make this code remove even and odd using a for loop without skipping any numbers?