Table of Contents

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

    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()

    * 
    * * 
    * * * 
    * * * *