-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (26 loc) · 964 Bytes
/
main.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
26
27
28
29
import random
user_action = input("Enter a choice (rock, paper, scissors): ")
possible_actions = ["R", "P", "S"]
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 == "R":
if computer_action == "S":
print("Rock sTashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif user_action == "P":
if computer_action == "R":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif user_action == "S":
if computer_action == "P":
print("Scissors cuts paper! You win!")
else:
print("Rock smashes scissors! You lose.")
elif user_action =="":
print("Please enter your choice")
elif user_action !="S,P,R":
print("Invalid choice")