This repository has been archived by the owner on Oct 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from flyinspaghetti/master
Rock-Paper-Scissors game in Python
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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)] |