print "You will now play a math game." lives = 3 score = 0 print "Simply answer the questions with the correct number." print "!!!The game will now begin!!!" print "Your current score is %s/5 and you have %d lives." % (score, lives) FQ = raw_input("What is 2 + 2" ) if FQ == "4": score += 1 print "\nGood job! Your score is now %s/5!" % (score) else: lives -=1 print "Better luck next time! Your score is now %s and you have %d lives remaining" % (score, lives)
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