0
What is 'while loops' and what is it used for?
In Control Structures, chapter no. 7 is While Loops. What is the use of 'i = i + 1' in the following code? i = 1 while i <=5: print(i) i = i + 1 print("Finished!")
1 Answer
+ 3
Without i = i + 1 the loop would never stop because i would always be 1 which is called an infinite loop