l = ["a", "b", "c", "d", "e"] for x in range(0, len(l)): if(len(l)==0): break print(l[x]) l.remove(l[x]) #the problem is the for loop after being emptied still executes once