import easygui as eg # SETTING THINGS UP (only need this once) eg.msgbox("Welcome to my awesome quiz!") score = 0 # QUESTION 1 answers = ["A bird","A plane","Superman","A house","A horse"] choice = eg.buttonbox("What is this?","Quiz!",answers,"house.gif") if choice == "A house": eg.msgbox("Well done!","Quiz!") score = score + 1 else: eg.msgbox("No, you muppet. It was a house!","Quiz!") # MORE QUESTIONS GO HERE answers = ["Football","Cricket","Rugby","Hockey","Banana racing"] choice = eg.buttonbox("What sport is this?","Quiz!",answers,"football.gif") if choice == "Football": eg.msgbox("Well done!","Quiz!") score = score + 1 else: eg.msgbox("No, you muppet. It was Football!","Quiz!") if score == 2: eg.msgbox("You know all","Quiz!") else: score <1 eg.msgbox ("You loser!!!","Quiz!") # END eg.msgbox("Well done, you scored " + str(score))
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