quiz_question=input("What is your favorite pet?: ")#This simply asks for your favorite pet. if quiz_question == "dog":#This line of code anwsers the anwser to the first question. print("woof")#It does this by respond with different anwsers, elif quiz_question == "cat":#Depending on the animal. print("meow") elif quiz_question == "fish": print("splash") elif quiz_question == "other": print("Ok.") #This is a line to make the code look neater. quiz_question_two=input("What is your favorite sport?: ")#Then it asks for your sport. if quiz_question_two == "football":#This anwsers the second question with a print("That's a very popular sport!")#programmed awnser. elif quiz_question_two == "Tennis": print("Thats a good sport") elif quiz_question_two == "rugby": print("Rugby is a very wierd sport") elif quiz_question_two == "other": print("I do not understand that sport.") #This is another line to make the code look neater. quiz_question_three=input("tea or coffee?: ")#It finally asks you for your prefrence in brew. if quiz_question_three == "Tea":#This responds to the question about tea or coffee. print("I like tea too!")#It does this via these pre-programmed anwsers. elif quiz_question_three == "coffee": print("I don't like coffee but I bet its great!") elif quiz_question_three == "other": print("I have not heard of that drink but I bet its great.") #This is the end of it.
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question