Header Ads

Loops In Python For Loop/while/Nested Loop with examples

     Loops In Python:

Short Definition:        

        Loop is a statement which is allows to repeat a program/statement or block statements.

                There are 3 types of loop in python

1 For loop

2 While loop

3 Nested loop

1) For loop 

For loop is used for iterate the statements or part of program several times. It is also used to  traverse the data structure like list, tuple Dictionary.

Example:


2) While loop:

Repeats a statement or group of statements while a going condition is True. It test the condition before executing the loop body.

Example:



3) Nested Loop:

Loop inside loop is called nested loop. Means one loop have another loop inside the first loop it is called Nested loop.

Example:


If you want to learn something more about Python then click on following link:

Variables & its types in Python

elif condition/statment

What is Python & reasons of Python

No comments

Powered by Blogger.