+ 12
Why the value i is 6 after "finished"?
i = 1 while i <=5: print(i) i = i + 1 print("Finished!")
5 Respuestas
+ 7
When i is 5, it still satisfies the condition of the loop so it is incremented to become 6. 😉
+ 2
it's states that I is either equal to or less than 5......so just add it up with 1
+ 2
because when i=5 , the condition is true, then the loop execute i=5+1.
0
because when i=5 condition satisfied.print 5 and the value of I increment to 6(i=6).then value of is I=6 the condition fail.then print rest of code.
0
Hasta el valor de 5 la condición de bucle es verdadera. Este se frena o se para cuando i tomé el valor de 6 , no antes. Por eso el valor final de I es. 6