Files
exercitii/python/extra/rock_paper_scissors.py
T
2026-03-29 00:49:18 +02:00

41 lines
881 B
Python

import random
computer = random.randint(1, 3)
print("===================")
print("Rock Paper Scissors")
print("===================")
print("1) ✊")
print("2) ✋")
print("3) ✌️ ")
icons = {
1: "",
2: "",
3: "✌️"
}
player = int(input("Pick a number: "))
print(f"You chose {icons[player]}")
print(f"CPU chose {icons[computer]}")
if (player == computer):
print("This ended in a draw. Recast.")
else:
if (player == 1):
if (computer == 2):
print("The CPU won.")
if (computer == 3):
print("The player won.")
if (player == 2):
if (computer == 1):
print("The player won.")
if (computer == 3):
print("The CPU won.")
if (player == 3):
if (computer == 1):
print("The CPU won.")
if (computer == 2):
print("The player won.")