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 trialARUN DAMODARAN
733 PointsIssues while running python code
Below is the code that I have written for one of the code challenges in the Python beginner track, The code is exactly same as the solutions provided by the instructor and still it does'nt work.
Need help!!!
name = input("Whats your Name? ")
usr_resp = input("{}, do you understand python while loops? \nEnter yes/no ".format(name))
while usr_resp != "yes":
print("ok, {}, while loops in Python repeat as long as a certain Boolean condition is met.".format(name))
user_resp = input("{}, now do you understand python while loops? \nEnter yes/no ".format(name))
print("That's great, {}. I 'm please that you understand while loops now. That was getting repetitive".format(name))
1 Answer
Steven Parker
231,248 PointsThe variable tested in the loop is "usr_resp", but the variable that gets the user answer (for the second question) is "user_resp" instead.
The name needs to be spelled the same way each time it is used.