primeList=[5, 7, 35, 67, 335, 469]
for i in primeList:
for x in range(2,i):
if (i%x)==0:
print(primeList)
primeList.remove(i)
print(primeList)
I want to remove all of the elements in the list that are not prime but for some reason this only seems to remove 35 when 335 and 469 should be removed.