+ 1

I performed a program using 'while', the program keeps running to infinity.

c = 50 while c < 90: print(c)

4th May 2021, 6:07 PM
Obed Ojingwa
Obed Ojingwa - avatar
3 Answers
0
here is an exemple: c = 50 while c < 90: print(c) c += 1 however, when counting like so, it would be better to go with a for loop. In python you would write it like so: for c in range(50, 90): print(c) I hope this helps :)
4th May 2021, 6:29 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
You need to increment c by one in the while loop. In your example c constantly has the value 50 , which is the reason why the while loop doesn't stop.
4th May 2021, 6:14 PM
Mihail
Mihail - avatar
0
thanks, can you show me an example
4th May 2021, 6:23 PM
Obed Ojingwa
Obed Ojingwa - avatar