-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.py
More file actions
143 lines (97 loc) · 3.55 KB
/
test2.py
File metadata and controls
143 lines (97 loc) · 3.55 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#create variables
import random
name = input("Hello! What is your name?\n")
print("\n" + name + ", are you ready?!")
count = 0
#define a function to play the game
def game():
count = 0
score = [0 , 0]
user_action = input("Enter a choice:\nrock, 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 covers 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("\nIts 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("\nIt's a tie!\n")
count += 1
print("Player Score: ", score[0])
print("Computer Score: ", score[1])
while count < 5:
game()
print("Game #: ", count + 1 ,"\n")
if count == 6:
break
count += 1
#call the function numbnuts
# def gameLoop(count):
# if count < 5:
# game()
# count += 1
# print(count)
# elif count == 5:
# print("Player Score: ", game.score[0])
# print("Computer Score: ", game.score[1])
# print("Game #: ", count)
# else:
# pass
#define a function that loops the game 5 times
# def game_five():
# if count < 5:
# game()
# else:
# print(counter(player1))
# print(counter())
# loop_five(count_user)
# # loop_five_comp(count_comp)
# print("Player:", score[0])
# print("Computer:", score[1])
# #define function that prints the score and who won
# score = 0
# def final_score():
# score = 0
# if user_action.score < 3:
# print("You lose!")
# else:
# print("You Win!")
# # #define a function to keep count (1 funct for user 1 funct for comp)
# # def counter(player1):
# # count = 0
# # if player1 == "rock":
# # count += 1
# # elif player1 == "scissors":
# # count += 0
# # else:
# # count +=0
# #define a function to only play game 5 times before printing the winner/count
# def game_five(game()):
# if count < 5:
# game()
# else:
# print(counter(player1))
# print(counter())