I am building a program in python. I have two lists and I want to loop through each of them to see if the elements are equal if they are I want to remove the one element from the list and I want to run a few codes. When this is done I want to return back to the loop to compare the lists again. until one list is empty and the program will continue.
I tried this but just can not get my mind to unblock it! Thank you.
x = [1,2,3,4,5,6,7] y = [28,1,2,3,4,5,6]
for i in x: for a in y: while i == a: x.remove(i)
Aucun commentaire:
Enregistrer un commentaire