0

in loop statement my result is different

i =1 ,while i<=5: ,print (i) ,i=i+1,print("finished"), result= 1finished , 2 finished , 3 finished , 4 finished , 5 finished.

4th Jun 2018, 10:26 AM
Nishant Shrimali
4 odpowiedzi
+ 1
What do you mean? What result did you expect?
4th Jun 2018, 10:58 AM
Matthias
Matthias - avatar
0
in sololearn result show = 1,2,3,4,5 finished. in the last step he show finished but my code every number then finished excute
4th Jun 2018, 11:46 AM
Nishant Shrimali
0
You have to put the print("finished") outside of the loop
4th Jun 2018, 12:41 PM
Matthias
Matthias - avatar
0
thanks, its work but only after save not work in python shell window by directly excute
4th Jun 2018, 2:00 PM
Nishant Shrimali