DEV Community

Discussion on: What is the simplest code to explain a loop?

Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

Someone in our team brought this:

times_eaten = 0
while(times_eaten < 3):
    print('I am eating')
    times_eaten += 1

As he would eat three times till he feels not hungry.

Collapse
 
tux0r profile image
tux0r

This one is probably the best. :)