update the iterator while looping through a list


This Content is from Stack Overflow. Question asked by Leimomi Bong

Newbie question… Looping through a list, and I want to update the iterator with the value at each index until I find the value ‘0’. Then return the index ‘0’ is located at.

I think it’s similar to a “sidewinder” algo, but I’m really unfamiliar!

here’s a photo of what i’m trying to do:

here's a photo of what's i'm trying to do


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?