-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest3.py
More file actions
71 lines (58 loc) · 2.12 KB
/
test3.py
File metadata and controls
71 lines (58 loc) · 2.12 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
#create variables
import random
import sys
name = input("Hello! What is your name?\n")
print("\n" + name + ", are you ready?!")
count = 0
score = [0 , 0]
keep_playing = True
#define a function to play the game
def game():
#count = 0
#score = [0 , 0]
user_action = input("\n\nEnter a choice: rock, paper, or scissors?\n")
possible_actions = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_actions)
if user_action == computer_action:
print(f"\n Both players selected {user_action}. IT'S A TIE!\n")
elif user_action == "rock":
if computer_action == "scissors":
print("\n ROCK SMASHES SCISSORS! YOU WIN!\n")
score[0] += 1
elif computer_action == "paper":
print("\n PAPER COVER ROCK! YOU LOSE.\n")
score[1] += 1
else:
print("\n IT'S A TIE!\n")
elif user_action == "paper":
if computer_action == "rock":
print("\n PAPER COVERS ROCK! YOU WIN!\n")
score[0] += 1
elif computer_action == "scissors":
print("\n SCISSORS CUTS PAPER! YOU LOSE.\n")
score[1] += 1
else:
print("\n IT'S A TIE!")
elif user_action == "scissors":
if computer_action == "paper":
print("\n SCISSORS CUTS PAPER! YOU WIN!\n")
score[0] += 1
elif computer_action == "rock":
print("\n ROCK SMASHES SCISSORS! YOU LOSE.\n")
score[1] += 1
else:
print("\n IT'S A TIE!\n")
while count < 5:
game()
print("Game #: ", count + 1 ,"\n")
if count == 6:
break
count += 1
print("Player Score: ", score[0])
print("Computer Score: ", score[1])
if score[0] > score[1]:
print("\nYou've won this round!\n\n")
elif score [0] < score[1]:
print("\nYou've lost this round!\n\n")
else:
print("\nThis rounds a tie! Great game!\n\n")