+ 4
[Solved] Why is the output of the following code 2359?
i = 1 while i <= 10: print(i+1) i *= 2
2 Answers
+ 3
i=1
i<=10 #true
print(i+1) #2
i=i*2 #i=2
i<=10 #true
print(i+1) #3
i=i*2 #i=4
i<=10 #true
print(i+1) #5
i=i*2 #i=8
i<=10 #true
print(i+1) #9
i=i*2 #i=16
i<=10 #false
I hope you understand!
+ 3
Vadivelan Got it... Thanks!