import random import time responses = ["Wait that's not possible. I lost?", "What's your strategy?", "How'd you beat me?", "There's no way I'm losing next time!", "No way!", "REMATCH", "That one doesn't count", 'YOU CHEATED', 'RIGGED', "No fair", "Do you have roids or something?"] print('Hi, I\'m Allyn. I\'m the world\'s greatest rock paper scissors AI.\nBet you can\'t beat me!\n') time.sleep(1) print("Let's play!!!") time.sleep(1) x = 0 while True: print('Rock') time.sleep(1) print('Paper') time.sleep(1) print('Scissors') time.sleep(1) print('Shoot\n') time.sleep(1) userChoice = input() if userChoice.lower() == 'rock': print('I choose SCISSORS!\n') elif userChoice.lower() == 'paper': print('I choose ROCK!\n') elif userChoice.lower() == 'scissors': print('I choose PAPER!\n') else: print("\nYou fool! That's not how you play.\n") continue time.sleep(1) print(random.choice(responses)) if x < 5: time.sleep(1) print("\nLet's play another round!") time.sleep(1) else: time.sleep(1) print("\nThis is stupid. I never even liked this game anyways.") exit() x += 1
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