Python Loops

In Python For loop, the statement is executed sequentially until the condition satisfied. The first statement in a function is executed first, followed by the second, and so on. Using Loops we can execute a block of code several times.

Python For Loop Diagram

Python has two types of loops

For loop sequence

A for loop is used for iterating over a sequence. A sequence can be String, Lists, Tuples, Dictionary.

# List Sequence Example
fruits = ["apple", "banana", "cherry"]
for x in fruits:

# String Sequence Example
for x in "StudyGyaan":

Range ( ) function in Python

The range() function is python in-build function, returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified number.

for x in range(6):
Python For Loops Video Tutorial

Whats Next – Python Loop Control Statements