diff --git a/day-04/pirate_treasure.py b/day-04/pirate_treasure.py index dc17543..77d3358 100644 --- a/day-04/pirate_treasure.py +++ b/day-04/pirate_treasure.py @@ -9,7 +9,6 @@ position = input() # Where do you want to put your treasure col = position[0] row = position[1] - map[string.ascii_lowercase.index(col)][int(row)-1] = 'X' print(f"{line1}\n{line2}\n{line3}") \ No newline at end of file diff --git a/day-04/rock_paper_scissors.py b/day-04/rock_paper_scissors.py new file mode 100644 index 0000000..171ae93 --- /dev/null +++ b/day-04/rock_paper_scissors.py @@ -0,0 +1,47 @@ +import random + +# Rock +rock = ''' + _______ +---' ____) + (_____) + (_____) + (____) +---.__(___) +''' + +# Paper +paper = ''' + _______ +---' ____)____ + ______) + _______) + _______) +---.__________) +''' + +# Scissors +scissors = ''' + _______ +---' ____)____ + ______) + __________) + (____) +---.__(___) +''' + +choices = [rock, paper, scissors] + +print("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors") +player_choice = int(input()) +print(f"You chose\n{choices[player_choice]}") + +computer_choice = random.randint(0, 2) +print(f"The computer chose\n{choices[computer_choice]}") + +if (player_choice == computer_choice): + print("Tie") +elif (player_choice == 0 and computer_choice == 1) or (player_choice == 1 and computer_choice == 2) or (player_choice == 2 and computer_choice == 0): + print("You lose") +elif (player_choice == 0 and computer_choice == 2) or (player_choice == 1 and computer_choice == 0) or (player_choice == 2 and computer_choice == 1): + print("You win")