Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Logic in Python Around and Around

While loops - Around and Around Tutorial

In the around and around tutorial why does the 'while' loop stop when it reaches 1? Why does it not carry on forever? I do not see where it becomes false.

1 Answer

James J. McCombie
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
James J. McCombie
Python Web Development Techdegree Graduate 21,199 Points

Do you mean the:

start = 0 while start: print(start) start -= 1

loop?

if so its because of 'truthy' and 'falsey' things. whatever is to the right of the 'while' keyword is evaluated to a true or false value. zero, empty strings, and others are falsey, 1 - 10 are truthy. So the loop runs until start = 0, which means while False, and the loop breaks

That's it!

Ahhh Okay, thank you, I remember the lesson now.

Thank you very much :)