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


Infinite Loop question in Python Basics - how to solve?

So one of the questions for the Python Basics quizzes is something like:

"How do you use the while statement to do an infinite loop?"

While ___________:

I tried 1 == 1 as an answer, and it wouldn't accept.

It seems there could be more than one way to answer this, but this seemed like the simplest way to do it on the single line provided. What is the correct answer supposed to be?

2 Answers

andi mitre
andi mitre
Treehouse Guest Teacher

Hey Steven,

You can create the infinite loop this way:

while True:
Chris Adamson
Chris Adamson
132,143 Points

Alternatively you could do it with negative logic:

while not False: