import random
user_action = input("Enter your choice (rock, paper, scissors): ")
posb_actions = ["rock", "paper", "scissors"]
computer_action = random.choice(posb_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! No one will lose")
elif user_action == "rock":
if computer_action == "scissors":
print("Rock is harder than scissors! You won!")
else:
print("Paper easily covers rock! You lost.")
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 smashes scissors! You lose.")
#This code considered by expert Suhrob Umarov
Comments
Leave a comment