-
Notifications
You must be signed in to change notification settings - Fork 2
/
play.py
25 lines (22 loc) · 905 Bytes
/
play.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
import random
while True:
user_action = input("Rock, paper, scissors? ")
possible_actions = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_actions)
if user_action == computer_action:
print(f'Both players selected {user_action}. Tie!')
elif user_action.lower() == "rock":
if computer_action.lower() == "scissors":
print("Rock smashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif user_action.lower() == "paper":
if computer_action.lower() == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif user_action.lower() == "scissors":
if computer_action.lower() == "paper":
print("Scissors cuts paper! You win!")
else:
print("Rock smashes scissors! You lose.")