+ 1
i = 1 while i <= 5: print (i) I = i+1 difference i = 1 ........ i = i+1 print (i)
3 odpowiedzi
+ 6
M. Watney Yup, I really missed that part. Thx for pointing
+ 5
So, u have two diff cases.
Case 1 :
I = 1
while I <= 5 :
print (I)
I = I + 1
Case 2 :
I = 1
I = I + 1
print (I)
In 1st case , Nothing will be printed as I is smaller than 5. In 2nd case, 2 will be printed.
+ 2
Arushi Singhania I guess you missed something.
In case 1, the statement i= i+1 should be indented and it'll print
1
2
3
4
5
As condition for while i.e. i<=5 will be true for i=1 to i=5.