-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock_Paper_Scissors_Game.py
More file actions
43 lines (35 loc) · 1.21 KB
/
Rock_Paper_Scissors_Game.py
File metadata and controls
43 lines (35 loc) · 1.21 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
import random
while True:
choices = ["rock", "paper", "scissors"]
computer = random.choice(choices)
player = None
while player not in choices:
player = input("Choose from rock, paper, or scissors: ").lower()
if player == computer:
print("Computer:",computer)
print("It's a Tie!")
elif player == "rock":
if computer == "paper":
print("Computer:",computer)
print("You lose!")
elif computer == "scissors":
print("Computer:",computer)
print("You won!")
elif player == "paper":
if computer == "rock":
print("Computer:",computer)
print("You won!")
elif computer == "scissors":
print("Computer:",computer)
print("You lose!")
elif player == "scissors":
if computer == "rock":
print("Computer:",computer)
print("You lose!")
elif computer == "paper":
print("Computer:",computer)
print("You win!")
play_again = input("Do you want to play again (yes/no)?: ").lower()
if play_again != "yes":
break
print("Thanks for playing the game!")