-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockpaperscissorcomputerv2.py
65 lines (57 loc) · 1.68 KB
/
rockpaperscissorcomputerv2.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from random import randint
playerWins = 0
computerWins = 0
win = 5
rock = 'rock'
paper = 'paper'
scissor = 'scissor'
while computerWins < win and playerWins < win:
print(f'Player: {playerWins}, Computer: {computerWins}')
print("...rock...")
print("...paper...")
print("...scissor...")
player = input("Enter your choice: ")
random_num = randint(0, 2)
if random_num == 0:
computer = "rock"
elif random_num == 1:
computer = "paper"
else:
computer = "scissor"
print(f"The computer picks: {computer}")
if player == computer:
print("It's a TIE!")
elif player == 'quit':
break
elif player == 'rock':
if computer == 'paper':
print('Computer WIN!')
print(f'Computer')
computerWins += 1
elif computer == 'scissor':
print('Player WIN!')
playerWins += 1
elif player == 'scissor':
if computer == 'rock':
print('Computer WIN!')
computerWins += 1
elif computer == 'paper':
print('Player WIN!')
playerWins += 1
elif player == 'paper':
if computer == 'scissor':
print('Computer WIN!')
computerWins += 1
elif computer == 'rock':
print('Player WIN!')
playerWins += 1
else:
print('Please enter the correct value')
print('FINAL SCORE...')
print(f'Player: {playerWins}, Computer: {computerWins}')
if playerWins > computerWins:
print('Congrats, you win!')
elif playerWins < computerWins:
print('You lose!')
else:
print('Thank you for playing')