-
Notifications
You must be signed in to change notification settings - Fork 2
/
game2.py
47 lines (46 loc) · 1.56 KB
/
game2.py
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
####################################################################################################################################################################
# Author: Prajwal Prakash
# Date: 16/11/2020, Updated on 31/05/2021
# Goal: To play Rock Paper Scissor with computer
###################################################################################################################################################################
from random import choice
v = ["Rock", "Paper", "Scissors"]
playing = False
tie = 0
win = 0
lose = 0
while not playing:
computer_move = choice(v)
player_move = input("""Rock,
Paper,
Scissors,
(Q) to Quit
""").capitalize()
if player_move == computer_move:
tie += 1
print("-->Tie! Total ties:", tie)
elif player_move == "rock":
if computer_move == "paper":
lose += 1
print("-->You lose! Total loses:", lose)
else:
win += 1
print("-->You win! Total wins:", win)
elif player_move == "paper":
if computer_move == "scissors":
lose += 1
print("-->You lose! Total loses:", lose)
else:
win += 1
print("-->You win! Total wins:", win)
elif player_move == "scissors":
if computer_move == "rock":
lose += 1
print("-->You lose! Total loses:", lose)
else:
win += 1
print("--> You win! Total wins:", win)
elif player_move == "Q":
playing = True
else:
print("-->That's not a valid play. Check your spelling")