Avatar ·

Remove the list elements under the condition

📁 method, List, Advanced Python Topics

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]