From 79dfe087c61358f1e6a261873ac2b1b36ec54744 Mon Sep 17 00:00:00 2001 From: marcv Date: Wed, 19 Aug 2026 15:16:34 +0200 Subject: [PATCH] Rock, Paper Scissors game, structure complete --- wip_rock-paper-scissors.py | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 wip_rock-paper-scissors.py diff --git a/wip_rock-paper-scissors.py b/wip_rock-paper-scissors.py new file mode 100644 index 0000000..7ed9caf --- /dev/null +++ b/wip_rock-paper-scissors.py @@ -0,0 +1,66 @@ +############################################# +# # +# Work in progress!! # +# # +############################################# + +import random +import sys +import time + +losses = 0 +wins = 0 +ties = 0 + +while True: + + # Computer choice: + + computer_choice = random.randint(1,3) + if computer_choice == 1: + computer_choice = 'Paper' + elif computer_choice == 2: + computer_choice = 'Rock' + elif computer_choice == 3: + computer_choice = 'Scissors' + + # Player choice: + player_choice = input('What do you choose? Rock(R), Paper(P), or Scissors(S)?\n>') + if player_choice == 'P': + player_choice = 'Paper' + elif player_choice == 'R': + player_choice = 'Rock' + elif player_choice == 'S': + player_choice = 'Scissors' + else: + print(f'The choice you made ("{player_choice}") is not valid. The program will now exit') + sys.exit() + + # Playing the game: + + if computer_choice == player_choice: + print('It is a tie!') + ties += 1 + elif computer_choice == 'Rock': + if player_choice == 'Scissors': + print('You lost, you chose Scissors and the computer chose rock!') + losses += 1 + elif player_choice == 'Paper': + print('You won, you chose scissors and the computer chose rock!') + wins += 1 + elif computer_choice == 'Paper': + if player_choice == 'Scissors': + print('You won, you chose Scissors and the computer chose paper!') + wins += 1 + elif player_choice == 'Rock': + print('You lost, you chose rock and the computer chose paper!') + losses += 1 + elif computer_choice == 'Scissors': + if player_choice == 'Paper': + print('You lost, computer chose scissors and you chose paper!') + losses += 1 + elif player_choice == 'Rock': + print('You won, computer chose scissors and you chose rock!') + wins += 1 + + \ No newline at end of file