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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Evan Drew](https://secure.gravatar.com/avatar/127526437671bce36c6e8ff838ba797c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Evan Drew
271 PointsI am making a small game an I want to know how do I keep loping it until they get the right answer?
first_name = input("hello there, what is your first name ")
if first_name == "ol, tate":
print("Guess what, thats the correct name you win!!!")
else:
print("bummer! not correct")
[MOD: Added ```python formatting -cf]
1 Answer
![Sam Sinton](https://secure.gravatar.com/avatar/0307438929829a053d0b5ae372c58e9f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Sam Sinton
2,103 PointsHi, there I have looked into your problem and come up with the solution below! In this solution, we ask for the name before it enters the loop and again only if they get it wrong.
If they guess right they will exit the loop and get the winner's statement.
Hope this helps!
first_name = input("hello there, what is your first name ")
while first_name != "ol, tate":
print("bummer! not correct")
first_name = input("hello there, what is your first name ")
print("Guess what, thats the correct name you win!!!")
Megan Amendola
Treehouse TeacherMegan Amendola
Treehouse TeacherHi! It will be easier to read through your code if it is formatted in markdown correctly. Here's a video on how to format code in markdown.