python - How to make a while loop exit when user enters a certain string? -


I am conducting a survey that asks the user about age, gender, etc., using a time-lapse Tax. If the user enters some stars like "cya" or "bye", then what is the procedure to exclude the program from the loop?

I know that I can make a one-statement after every input, but is there a quick / easy way to do this?

Example of what I want to achieve:

  while (the user has not entered "cya"): age = int (input ("how old?" Edit): This example was too small, but the survey I am doing is too long, so every test variable takes a lot of time. is.  

I think the easiest way to do a survey is to list all your questions, and then Use it to make dictionary of all your user details. Answer: If not in the answer ("Bye," "CA"), the answer is: "Question" [= (["gender", "What is your gender?"), Response = "" Feedback = Response to Input ("Bye", "CA"): Brake Details [Description], "Age", "How old?"), ("Name", "What is your name?") = Response Print (Details)

Example:

  What is your gender? How old is M? what is your name? 'Gender': 'm', 'age': '5', 'name': 'zon') What is your gender? how old is? Al {'gender': 'm'}    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -