-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType 1
More file actions
41 lines (36 loc) · 1.09 KB
/
Type 1
File metadata and controls
41 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Game version 1
repeat = 'yes'
while (repeat == 'yes'):
#Randomizing computer choice
import random
#player's choice
player = input("Pick one! (rock, paper, or scissors): ")
possible_actions = ["rock", "paper", "scissors"]
#computers choice
computer = random.choice(possible_actions)
print(f"\n You chose {player}, computer chose {computer}.\n")
#If -> Then -> Else
#Who wins / tie
if player == computer:
print(f"Both players selected {player}. It's a tie!")
#Rock
elif player == "rock":
if computer == "scissors":
print("Rock smashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
#Paper
elif player == "paper":
if computer == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
#Scissors
elif player == "scissors":
if computer == "paper":
print("Scissors cuts paper! You win!")
else:
print("Rock smashes scissors! You lose.")
print('------------------')
repeat = input("Would you like to play again? (yes or no): ")
print("Thank you for playing!")