Step 1: Understand range(5, -1, -1)
-
range(start, stop, step)
-
Starts at 5, goes down to -1 (but not including -1), step = -1.
-
So it generates: 5, 4, 3, 2, 1, 0
Step 2: Loop through values
Iteration values of i: 5, 4, 3, 2, 1, 0
Step 3: Apply condition
-
When i == 3:
continue is executed → it skips printing this value and moves to the next iteration.
Step 4: Printing values
-
Prints 5
-
Prints 4
-
Skips 3
-
Prints 2
-
Prints 1
-
Prints 0
✅ Final Output:
5 4 2 1 0


0 Comments:
Post a Comment