i wanted this command to remove the item i.e. 'copy' from the list. But it removes the next element i.e. 'pen'.
listblock=["ball","copy","pen","paper","bat"] for item in listblock: if item == "copy": listblock.remove(item)
Aucun commentaire:
Enregistrer un commentaire