+ 4

[Solved] Why is the output of the following code 2359?

i = 1 while i <= 10: print(i+1) i *= 2

28th Sep 2020, 2:45 AM
Rahul Hemdev
Rahul Hemdev - avatar
2 odpowiedzi
+ 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!
28th Sep 2020, 2:55 AM
Vadivelan
+ 3
Vadivelan Got it... Thanks!
28th Sep 2020, 2:58 AM
Rahul Hemdev
Rahul Hemdev - avatar