Loop not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Loop not working?

When I type age + 1 then it just goes 1 over than the expected number? Any help appreciates =) https://code.sololearn.com/cj96ZnRR3JAI/?ref=app

8th Dec 2018, 12:29 PM
Nickolay W.
Nickolay W. - avatar
2 Answers
+ 6
https://code.sololearn.com/cx0JnrP6skq1/?ref=app
8th Dec 2018, 1:43 PM
Rstar
Rstar - avatar
+ 3
Your loop runs while age is less than or equal too 18... It is ALWAYS less than or equal to with your code so the loop will run forever age = 7 while age < 18: age += 1 if age == 18: print(age) print("yeeeeaas")
8th Dec 2018, 12:55 PM
LordHill
LordHill - avatar