Loops in Python

A loop statement allows us to execute a statement or group of statements multiple times. The basic types of loop involved are :
1. For loop
2. While loop
Let’s discuss the syntax in Python. I will make a code snippet using Jupyter notebook, for this, you can also useĀ Python Idle.

The syntax of for loop

Range function takes 2 parameters – starting index and stopping index

The syntax for a while loop

To print in a single line

Close Menu