I've got this piece of code that modifies a list based on a condition:
lst = [0, 0, 0, 2, 1]
for i, x in enumerate(reversed(lst)):
if x == 0:
lst[-i-1] = 9
break
Is there a way I can do this in a better, more optimised way and without a while loop?