import random def magicNumber(): myNumber = random.randint(0,10) return myNumber def printAnswer(answerNumber): if answerNumber == 0: print("It is certain") if answerNumber == 1: print("It is decidedly so") if answerNumber == 2: print("Without a doubt") if answerNumber == 3: print("Yes definitely") if answerNumber == 4: print("Reply hazy try again") if answerNumber == 5: print("Ask again later") if answerNumber == 6: print("Better not tell you now") if answerNumber == 7: print("Don't count on it") if answerNumber == 8: print("My reply is no") if answerNumber == 9: print("My sources say no") if answerNumber == 10: print("Yes") userQuestion=raw_input() print("You asked: " + userQuestion) print("The answer is: "), rndNum = magicNumber() printAnswer(rndNum)
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