-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType 4
More file actions
72 lines (65 loc) · 2.33 KB
/
Type 4
File metadata and controls
72 lines (65 loc) · 2.33 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
repeat = 'yes'
while (repeat == 'yes'):
#Randomizing computer choice
import random
#points
computer_point = 0
player_point = 0
while computer_point < 3 and player_point < 3:
#player's choice
player = input("Pick one! (rock, paper, scissors, or random): ")
possible_actions = ["rock", "paper", "scissors"]
#random choice
if player == 'random':
player = random.choice(possible_actions)
#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!")
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
#Rock
elif player == "rock":
if computer == "scissors":
print("Rock smashes scissors! You win!")
player_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
else:
print("Paper covers rock! You lose.")
computer_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
#Paper
elif player == "paper":
if computer == "rock":
print("Paper covers rock! You win!")
player_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
else:
print("Scissors cuts paper! You lose.")
computer_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
#Scissors
elif player == "scissors":
if computer == "paper":
print("Scissors cuts paper! You win!")
player_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
else:
print("Rock smashes scissors! You lose.")
computer_point += 1
print(f"computer score is {computer_point}.")
print(f"Players score is {player_point}.")
print('------------------')
if (computer_point > player_point):
repeat = input("You lost.. would you like to try again? (yes or no): ")
else:
repeat = input("You won! Want to see if you can do it again? (yes or no): ")
print("Thank you for playing!")