This community-built FAQ covers the “Simple errors” exercise in Codecademy’s lessons on Python.
FAQs for the Codecademy Python exercise Simple errors:
Join the Discussion. We Want to Hear From You!
Have a new question or can answer someone else’s? Reply () to an existing thread!
Agree with a comment or answer? Like () to up-vote the contribution!
Need broader help or resources about Python in general? Go here!
Want to take the conversation in a totally different direction? Join our wider discussions.
Learn more about how to use this guide.
Found a bug? Report it!
Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!
None of the above? Find out where to ask other questions here!
Why doesn’t an “or” statement work? I thought “and” checked for two true statements.
I was wondering that as well. I tried with an ‘or’ statement which I thought was correct instead of an ‘and’ statement.
Me too. Seems like ‘and’ would mean that choice would have to equal both “y” and “n”… confused.
Hello, @code7532425724, welcome to the forums.
Consider the purpose of the exercise. We want to repeat the action of asking for input from the user while a specific condition is
True. What is that condition? If the user inputs a ‘y’ or a ‘n’ we don’t want to ask for the input again, but if they input anything else, we do, so how do we write that as a condition for a
while loop that repeats while the condition is
Thank you- that makes sense. For the ‘while’ statement to return true both conditions must be met, meaning choice cannot =“y” and choice cannot = “n”. If we used ‘or’ when one condition was met (in this case triggering False) the other condition would still be true, so ‘or’ would return True and would create an infinite loop.
Exactly. Keep up the good work!