List index out of range


while i<len(text_list):
    if (text_list[i]=="!" and text_list[i+1].islower()) :                
    	del text_list[i]     
    i += 1

I am a beginner programmer. I don't understand why i get the "List index out of range" error.


Where is your test_list?


This is a part of the program. It's not the whole program.


del removes a specific index hence your index got messed up. Which is why there's the error.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.