Created
June 9, 2022 14:12
-
-
Save Pythonian/b46cd0e414d63aafbaa62817d2deacb9 to your computer and use it in GitHub Desktop.
Task Title: Creating and Using [Local] Python Packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
game_choices = ["R", "P", "S"] | |
print("Let's [R]ock, [P]aper, [S]cissors!!!\n") | |
while True: | |
computer_choice = random.choice(game_choices) | |
player_choice = str(input("Your choice of letter? ")) | |
while player_choice not in game_choices: | |
player_choice = str(input( | |
"\nInvalid choice. Options are [R], [P] or [S]: ")) | |
print() | |
if player_choice == "R" and computer_choice == "S": | |
print("Player: Rock") | |
print("Computer: Scissors") | |
print('Player wins, Rock beats Scissors') | |
break | |
elif player_choice == "P" and computer_choice == "R": | |
print("Player: Paper") | |
print("Computer: Rock") | |
print('Player wins, Paper beats Rock') | |
break | |
elif player_choice == "S" and computer_choice == "P": | |
print("Player: Scissors") | |
print("Computer: Paper") | |
print('Player wins, Scissors beats Paper') | |
break | |
elif player_choice == "R" and computer_choice == "P": | |
print("Player: Rock") | |
print("Computer: Paper") | |
print('Computer wins, Paper beats Rock') | |
break | |
elif player_choice == "P" and computer_choice == "S": | |
print("Player: Paper") | |
print("Computer: Scissors") | |
print('Computer wins, Scissors beats Paper') | |
break | |
elif player_choice == "S" and computer_choice == "R": | |
print("Player: Scissors") | |
print("Computer: Rock") | |
print('Computer wins, Rock beats Scissors') | |
break | |
elif player_choice == computer_choice: | |
print('Same selection. It is a f***ng tie!\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment