+ 1
Basic difference between these two codes are....plz help. Upper one is written by me and lower i copied ..
n = 1 while n <=10: print(n) i = i + 1 print("finished") i = 1 while i <=5: print(i) i = i + 1 print("Finished!")
2 Answers
+ 12
There's a little problem in the upper code... See the 4th line
i = i + 1
â
Instead of "i" it should be "n".
Else the code will result in an infinite loop.
Corrected Code -
n = 1
while n<=10:
print(n)
n = n + 1
print("finished")
+ 1
thanks.... brother.....