0

What os the use of i = i+1 in this code?

https://code.sololearn.com/cTBj5KYFUPn5/?ref=app

13th Dec 2017, 5:26 PM
Arjun Mahanty
Arjun Mahanty - avatar
2 Antworten
+ 13
It increments (increases) the value of i by 1 when i =1 i= 1+1=> i=2 #new i value i=2+1=> i=3 #new i value This continues till i < =5 when i becomes 6 the while loop stops and prints Finished
13th Dec 2017, 5:34 PM
Frost
Frost - avatar
0
i += 1 works also in place of i = i + 1. i += 1 increments the value of i by 1 and assigns the new value to i.
13th Dec 2017, 6:01 PM
Bob
Bob - avatar