Created
January 29, 2022 08:31
-
-
Save bennyscripts/f4a2bd3629ff3d8305cd335d5b7d772c to your computer and use it in GitHub Desktop.
Super simple Rock Paper Scissors game in Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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