Step-by-Step Explanation:
✅ Outer Loop:
This means i will take values: 0, 1
(range(2) gives [0, 1])
✅ Inner Loop:
This means j will start from the current value of i and go up to 1 (inclusive).
So it changes depending on the value of i.
๐ Iteration Breakdown:
๐น When i = 0:
Prints:
๐น When i = 1:
Prints:
Final Output:
๐ก Summary:
-
Outer loop controls the starting point of inner loop.
-
Inner loop prints from current i to 1.
-
Useful in upper triangular matrix or combinations logic.


0 Comments:
Post a Comment