Introduction
In this article, I will explain the for loop in Python. For loops are used for sequential traversal. For example: traversing a listing or string or array etc. In Python, there may be no C style. For a loop example: for (i=0; i<n; i + +) there is a” for in” loop, which is just like a for each loop in other languages. Let's discover ways to use a for-in loop for sequential traversals. A for statement is executing within the inside statement once or more. Once False, the next code will be executed.

- Syntaxfor i in range condition:
- statement
Example
Here's a simple program for the "for loop”.
- for i in range(1,15):
- print(i)
Output
Remember that i's value is 15, so the block of code will be executed 15 times.

For Loop and Break statement
With the break declaration, we can stop the loop even if the while condition is true.
Syntax
- for i in range condition:
- if condition:
- break
Example
Here's a simple program for the "for loop” and “break statement”
- for i in range(1,15):
- if i == 6:
- break
- print(i)
Output
Note that it runs up until the number 6, and after the number, there's no display in the Output screen.

For Loop and Continue Statement
The continue statement is used to leave a sum statement, then it continues with the next statement.




Join the conversation! Your thoughts help the community grow.