I'm having a list of strings. I don't need some of the strings as it's a repeating header. I defined a function using while loop that should remove the strings, however I need to run the cell multiple times as the while loop stops before i=len(list_of_strings). If I run the cell multiple times, then it eventually works. What did I do wrong?
def header_eraser(list_of_strings):
i=0
while i < len(list_of_strings):
if list_of_strings[i] in headers:
del list_of_strings[i]
i+=1
else:
i+=1