Avatar ·

Remove the list elements under the condition

📁 метод, список, python

there is a list

  lst = [ 0 ,  95  0 ,  76 ,  0 ,  23 ,  68 ,  0 ,  23 ,  156 ,  95 ]  

you need to delete each element following 0

to get on output:

  New_lst = [ 0 ,  0 ,  0 ,  68 ,  0 ,  156 ,  95 ]     

method str.index () does not help me, since only the first coincidence retus, and C enumerate does not work out.