--Originally published at Start in the world of the #TC101
To keep a computer doing useful work we need repetition, looping back over the same block of code again and again.
- For Loop
The for loop that is used to iterate over elements of a sequence, it is often used when you have a piece of code which you want to repeat “n” number of time
- While Loop
The while loop tells the computer to do something as long as the condition is met it’s construct consists of a block of code and a condition.
- Nested Loops
In some script you may want to use nested loops. A nested loop is a loop inside a loop.
- Break
To break out from a loop, you can use the keyword “break”.
- Continue
The continue statement is used to tell Python to skip the rest of the statements in the current loop block and to continue to the next iteration of the loop.
Source: http://www.pythonforbeginners.com/loops/for-while-and-nested-loops-in-python (You can find here some examples)