forked from mr-sergi/Hacktoberfest-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRockPaperScissorGame.py
29 lines (26 loc) · 975 Bytes
/
RockPaperScissorGame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import random
while True:
user = input("Enter a choice (rock, paper, scissors): ")
possible = ["rock", "paper", "scissors"]
computer = random.choice(possible)
print(f"\nYou chose {user}, computer chose {computer}.\n")
if user == computer:
print(f"Both players selected {user}. It's a tie!")
elif user == "rock":
if computer == "scissors":
print("Rock smashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif user == "paper":
if computer == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif user == "scissors":
if computer == "paper":
print("Scissors cuts paper! You win!")
else:
print("Rock smashes scissors! You lose.")
play = input("Do you want to play again? (y/n): ")
if play.lower() != "y":
break