Loop 4/19

choice = raw_input('Enjoying the course? (y/n)')

while choice != "y" and choice !="n":  
  choice = raw_input("Sorry, I didn't catch that. Enter again: ")

every time i use the “raw_input” command , everything is going wrong


What exactly is going wrong in this case? Are you asking something here?

(Also, please place ``` on its own line before and after the code)


Shouldn’t that be “or” not “and”?


You’re right
Thank you

Provenance : Courrier pour Windows 10


using or will cause an infinity loop, and is the right operator to use. What is the problem?


When I run the same code as bal 49, the program just runs and runs without returning anything on the consul (not even an error). 49 PM


sorry I added the “print choice” because I was just throwing stuff at the wall, but even without it I get the same issue


given you nested the print statement inside the while loop, it only prints when the first choice is invalid, and you enter a second choice within the second raw_input


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.