Browse Source

lists

master
Ken Schaefer 9 months ago
parent
commit
494b54c47b
  1. 1
      day-04/pirate_treasure.py
  2. 47
      day-04/rock_paper_scissors.py

1
day-04/pirate_treasure.py

@ -9,7 +9,6 @@ position = input() # Where do you want to put your treasure
col = position[0] col = position[0]
row = position[1] row = position[1]
map[string.ascii_lowercase.index(col)][int(row)-1] = 'X' map[string.ascii_lowercase.index(col)][int(row)-1] = 'X'
print(f"{line1}\n{line2}\n{line3}") print(f"{line1}\n{line2}\n{line3}")

47
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")
Loading…
Cancel
Save