-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRockPaperScissors.py
More file actions
31 lines (24 loc) · 871 Bytes
/
RockPaperScissors.py
File metadata and controls
31 lines (24 loc) · 871 Bytes
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
30
31
# Rock Paper Scissors game
import random
options = ("Rock","Paper","Scissors")
running = True
while running:
player = None
computer = random.choice(options)
while player not in options:
player = input("Enter a Choice (Rock,Paper,Scissors): ")
print(f"Player: {player}")
print(f"Computer: {computer}")
if player == computer:
print(f"Both players selected {player}. It's a tie!")
elif player == "rock" and computer == "Scissors":
print("Player Wins!")
elif player == "paper" and computer == "rock":
print("Player Wins!")
elif player == "scissors" and computer == "paper":
print("Player Wins!")
else:
print("Player Loses!")
if not input("Do you want to play again(Y/N): ").lower() =='y':
running = False
print("Thanks for playing :)")