import random def main(): computerChoice = random.randint(1,3) playerChoosing = True while playerChoosing == True: print ("which chapter would you like a question from? (Ch. 1-3) ") playerChoice = raw_input() if playerChoice == "1": print "what is the reciprocal of -3/2x?" playerChoosing = False elif playerChoice == "2": print "Find the exact value for the cos(60)" playerChoosing = False elif playerChoice == "3": print "What is the compliment angle of 70 degrees? (Just print number)" playerChoosing = False else: print "That is not a choice" playerChoosing = True if playerChoice == "1": print "Type ok when you are ready for the answer " action = raw_input() if action == "ok": print "The correct answer is -2/3x" else: print "That is not a choice" elif playerChoice == "2": print "Type ok when you are ready for the answer " action = raw_input() if action == "ok": print "The correct answer is 1/2" else: print "That is not a choice" elif playerChoice == "3": print "Type ok when you are ready for the answer " action = raw_input() if action == "ok": print "The correct answer is 20 degrees" else: print "That is not a choice" main()
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