I am very new to python.I had a small query about for loop in c++ and python.In c,c++ if we modify the variable i as shown in below example ,that new value of i reflects in the next iteration but this is not the case in for loop in python.So ,how to deal with it in python when it is really required to skip some iterations without actually using functions like continue ,etc.
for loop in c++
for(int i=0;i<5;++i)
{
if(i==2)
i=i+2;
cout<<i<<endl;
}
Output
0
1
4
for loop in python
for i in range(5):
if i==2:
i=i+2
print i
Output
0
1
4
3
4
whileto do such things.