-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockpapper.py
More file actions
24 lines (23 loc) · 905 Bytes
/
rockpapper.py
File metadata and controls
24 lines (23 loc) · 905 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
# wap to play rock papper scissor
import random
user_action = input("Enter a choice (1.rock, 2.paper, 3.scissors): ")
possible_actions = [ "1.rock", "2.paper", "3.scissors"]
computer_action = random.choice(possible_actions)
print(f"\nYou chose {user_action}, computer chose {computer_action}.\n")
if user_action == computer_action:
print(f"Both players selected {user_action}. It's a tie!")
elif user_action == "rock":
if computer_action == "scissors":
print("Rock Breaks scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif user_action == "paper":
if computer_action == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif user_action == "scissors":
if computer_action == "paper":
print("Scissors cuts paper! You win!")
else:
print("Rock Breaks scissors! You lose.")