Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #179 from flyinspaghetti/master
Browse files Browse the repository at this point in the history
Rock-Paper-Scissors game in Python
  • Loading branch information
bhaveshlohana committed Oct 1, 2020
2 parents 09ce2d1 + 2ac364a commit 1dbba11
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Games/rock-paper-scissors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from random import randint


choice = ["Rock", "Paper", "Scissors"]

opponent = choice[randint(0, 2)]

player = False

while player == False:
player = input("Rock, Paper, Scissors?: ")
print("Opponent chose: ", opponent)
if player == opponent:
print("Tie!")
elif player == "Rock":
if opponent == "Paper":
print("You lose! Paper beats Rock.")
else:
print("You win!", player, "beats", opponent)
elif player == "Paper":
if opponent == "Scissors":
print("You lose!", opponent, "beats", player)
else:
print("You win!", player, "beats", opponent)
elif player == "Scissors":
if opponent == "Rock":
print("You lose...", opponent, "beats", player)
else:
print("You win!", player, "beats", opponent)
else:
print("Input Error")
player = False
opponent = choice[randint(0, 2)]

0 comments on commit 1dbba11

Please sign in to comment.