While loop for beginner

Wanted to ask whether i=3 is the final point of the code and we have no right to take numbers that are higher than it,such as “4” ,but only the lower ones ,such as “2,1,0”?

In the code you shared, i is first initialised with value 3 (i=3).
After this the while loop will start executing since its condition (i>=0) is True.
and in the body of the loop you have two instructions which will be executed: printing i and decrementing i.
So for the first iteration 3 will be printed (the value of i) and i is decremented and will become 2, in the next iteration 2 is printed (the new value of i) and then decremented again and becomes 1.
Until i becomes -1 and then the loop condition will be false and the loop will not be executed.
So there is no way for i to have a value greater than 3 , and smaller than 0 as well.
Hope this will help.

1 Like