I need to make a simple python script, but as I mostly do PHP / C++ I find it hard to manage myself without simple for loops. Let's say I have a code:
for(int i = 0; i < some_string_length; i++)
{
//do something...
}
As you can see it simply goes as many times as many letters I have in my string. Of course, I could do this in a while loop, but that has an issue. I have to either create a variable outside of the loop which will make it global or create it inside the loop, but this variable's value can't be used in the argument of loop.
Wrong:
while(i < some_string_length)
{
i = something; //declaring i for the first time
i++;
}
As you can see it doesn't make sense at all. So how can I do this?