Python Loops: How To Use Them
What is Python Loop
All the lines of code are executed sequentially in programming languages in more simple words it means, there are ten lines of code when you run the program the very first line will execute firstly and then second and this goes on until all the lines of code end. But in some cases, you are in a situation where you want to run a block of code more than once to perform some of your function at these points loops are used to perform the task.
Python Loop Flow Chart
The above flow chart shows that there is always some type of condition in the loop to run. If the condition becomes true loop runs otherwise it will not run.
Python Loop Kinds
Below are the following Python loops that help us to execute some specific block of code more than once.
|Sr. No.||Python Loops|
This loops first check the given condition if it is TRUE then executes the block of code for looping.
This loop run number-wise and keep looping until the end of the numbers.
This type of loop becomes handy in case when you need to use one loop inside another loop.