From 066c9a1578ededf75f49d53d9106596f25c7aed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandru=20Tof=C4=83nel?= Date: Sun, 29 Mar 2026 00:49:18 +0200 Subject: [PATCH] rock, paper, scissors --- python/extra/rock_paper_scissors.py | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 python/extra/rock_paper_scissors.py diff --git a/python/extra/rock_paper_scissors.py b/python/extra/rock_paper_scissors.py new file mode 100644 index 0000000..403be62 --- /dev/null +++ b/python/extra/rock_paper_scissors.py @@ -0,0 +1,40 @@ +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.")