While Loop in Python

Shweta Jadhav
Dec 6, 2023

--

Hello friends, I have come up with another interesting function in python i.e. Loops. Python provides three ways to executing the loops. While loops in python, For loop in Python, Nested loops in python.

While Loop in Python: In python a while loop is used to execute a block of statement repeatedly until given condition is satisfied. And the given condition becomes false, the line immediately after the loop in the program is executed.

Ex:

Using Else statement with while loop in python: The else clause is only executed when while condition becomes false, if you break out of the loop, if an exception is raised, it won't be executed.

#Syntax of while loop with else condition:

#Example of while loop with else in python:

#VevCodeLab

http://vevcodelab.com/

--

--