Loop 4/19


#1
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


#2

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)


#3

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


#4

You’re right
Thank you

Provenance : Courrier pour Windows 10


#5

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


#6

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


#7

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


#8

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


#9

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