Skip to content

Instantly share code, notes, and snippets.

@bennyscripts
Created January 29, 2022 08:31
Show Gist options
  • Save bennyscripts/f4a2bd3629ff3d8305cd335d5b7d772c to your computer and use it in GitHub Desktop.
Save bennyscripts/f4a2bd3629ff3d8305cd335d5b7d772c to your computer and use it in GitHub Desktop.
Super simple Rock Paper Scissors game in Python.
import random
choices = ["rock", "paper", "scissors"]
beats = {"rock": "scissors", "paper": "rock", "scissors": "paper"}
player = False
while not player:
player = input("rock, paper, or scissors? ").lower()
computer = random.choice(choices)
if beats[player] == computer: print(f"You won! {player} beats {computer}")
elif player == computer: print("It's a tie! Try again.")
else: print("You lost! Better luck next time.")
play_again = input("Play again? (y/n) ").lower()
if play_again == "n": player = True
else: player = False
print("Thanks for playing!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment