-
Notifications
You must be signed in to change notification settings - Fork 0
/
RockPaperScissorGame.py
64 lines (52 loc) · 1.53 KB
/
RockPaperScissorGame.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
import random
computerScore = 0
PlayerScore = 0
while True:
choices = ["rock","paper","scissors"]
computer = random.choice(choices)
player = None
while player not in choices:
player = input("rock, paper, or scissors ?:").lower()
if player == computer:
print("Computer:", computer)
print("Player:", player)
print("It's tie")
elif player == "rock":
if computer == "paper":
print("Computer:", computer)
print("Player:", player)
print("You lose!")
computerScore += 1
if computer == "scissors":
print("Computer:", computer)
print("Player:", player)
print("You Win!")
PlayerScore += 1
elif player == "scissors":
if computer == "rock":
print("Computer:", computer)
print("Player:", player)
print("You lose!")
computerScore += 1
if computer == "paper":
print("Computer:", computer)
print("Player:", player)
print("You win!")
PlayerScore += 1
elif player == "paper":
if computer == "scissors":
print("Computer:", computer)
print("Player:", player)
print("You lose!")
computerScore += 1
if computer == "rock":
print("Computer:", computer)
print("Player:", player)
print("You win!")
PlayerScore += 1
play_again = input("Play again? (yes / no): ").lower()
if play_again != "yes":
break
print("BYE !")
print("PLAYER SCORE :",PlayerScore)
print("COMPUTER SCORE :",computerScore)