Categories
Python

Python for loop

In Python, the for loop works differently.If we try to modify the loop iterator variable, it will be simply skipped and iterator will continue from its next value irrespective of the modification.

So in case if we need to modify the loop iterator value in our logic, we have to choose while loop. for loop cannot be used in this scenario. Here is the code snippet to see it in action:

for i in range(1,10):
if i==3:
i+=2
print i
Categories
Python

Learning Python

Started learning Python using A Byte Of Python by Swaroop CH few weeks back.Started loving this programming language. It’s so simple and easy to learn.Also gathered couple of other good books from fellow Python enthusiast at work, Joe Jacob.Thank you Joe.

 

I will post any interesting information I find in Python.