[python] 3.6
Hello, I was trying to iterate over a list with a for cycle, where I had to restart the cycle whenever a condition was confirmed.
In C I would do:
for(i = 0; i < 10; i++){
if(list[i] == something)
i = 0;
}
Here I was trying to do this:
for x in listPrimes:
if((num % x) == 0):
num /= x # divide by the prime
factorials.append(x)
x = 2 # reset to the first prime in the list?
which doesn't work correctly. What are the ways to reset the for to a certain iteration of the list? Do I have to do the for in some other way?
Thanks for your time