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!
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
Steven Zhang310 Points
repeating the code until a certain input
Before you read the question, please look at where I am in the python language course.
I want to repeat my code over and over before the user inputs a certain word. I was thinking of While loops or functions. Is there any way I can repeat the code with just while loops, and how?
Steven Parker225,713 Points
Repeating code is exactly what loops are good for. A simple example that meets your description might be:
word = None while word != "certain": word = input("What is the special word? ") print("Yep, that was it!")