-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_rock_paper_scissors.py
More file actions
45 lines (42 loc) · 1.45 KB
/
Copy path03_rock_paper_scissors.py
File metadata and controls
45 lines (42 loc) · 1.45 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
44
45
import random
while True:
choices = ["rock", "paper", "scissors"]
computer = random.choice(choices)
player_choice = None
while player_choice not in choices:
player_choice = input("rock, paper or scissors: ").lower()
if computer == player_choice:
print("Computer: ",computer)
print("Player: ",player_choice)
print("TIE!")
elif player_choice == "rock":
if computer == "paper":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU LOSE!")
if computer == "scissors":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU WIN!")
elif player_choice == "paper":
if computer == "scissors":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU LOSE!")
if computer == "rock":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU WIN!")
elif player_choice == "scissors":
if computer == "rock":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU LOSE!")
if computer == "paper":
print("Computer: ",computer)
print("Player: ",player_choice)
print("YOU WIN!")
play_again = input("Play again? (yes/no): ").lower()
if play_again != "yes":
break
print("BYE!")