samedi 30 juin 2018

IndexError: list index out of range >>> python [duplicate]

This question already has an answer here:

 a=['a','b','c','d']


 b=['l','b','n','d']


 for i in range(len(a)):
   for j in range(len(b)):
     if(a[i]==b[j]):
       b.remove(b[j])  //error here

 print(b)

what is error if i am wring print() statement work fine but b.remove() is not working

Aucun commentaire:

Enregistrer un commentaire