0 points

Nested while loop


dashboard

Tue Apr 21 2020 06:12:11 GMT+0000 (UTC)

Posted by @ShayHeart #python #python #loop #whileloop #nestedwhile loop

 #declare two set the range
1.i = 1
2.j = 5
#use while loop for i
3.while i < 4:
#use while loop for j    
4.while j < 8:
        5.print(i, ",", j)
        6.j = j + 1
        7.i = i + 1
Output:
1 , 5
2 , 6
3 , 7                               
                                
content_copy Copy

A loop within a loop is called nested loop. So here we use while loop within another while loop so its nested while loop.

https://beginnersbook.com/2018/01/python-while-loop/