Understanding Python Nested Loops: A Guide to Multi-Level Looping

Rumman Ansari   Software Engineer   2024-07-26 07:13:42   197  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Python Nested Loops

A loop may contain another loop in its body, this inner loop is called nested loop. But in a nested loop, the inner loop must terminate before the outer loop.

for i in range(1,6):
    for j in range (1,i):
        print("*", end=" ")
    print()

* 
* * 
* * * 
* * * * 
MCQ Available

There are 1 MCQs available for this topic.

1 MCQ