-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RockPaperScissors.py
70 lines (60 loc) · 2.22 KB
/
RockPaperScissors.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
66
67
68
69
70
import random
computer_score, player_score = 0, 0
while True:
choices = ["Rock","Paper","Scissors"]
computer_choice = random.choice(choices)
player_choice = None
while player_choice not in choices:
player_choice = input("Rock, Paper, or Scissors?: ").lower().capitalize()
if player_choice == computer_choice:
print("Computer: ",computer_choice)
print("Player: ",player_choice)
print("Its a Tie!\n")
computer_score += 1
player_score += 1
elif player_choice == "Rock":
if computer_choice == "Paper":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You lose!\n")
computer_score += 1
if computer_choice == "Scissors":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You win!\n")
player_score += 1
elif player_choice == "Scissors":
if computer_choice == "Rock":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You lose!\n")
computer_score += 1
if computer_choice == "Paper":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You win!\n")
player_score += 1
elif player_choice == "Paper":
if computer_choice == "Scissors":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You lose!\n")
computer_score += 1
if computer_choice == "Rock":
print("Computer: ", computer_choice)
print("Player: ", player_choice)
print("You win!\n")
player_score += 1
if computer_score == 10 or player_score == 10:
break
print("="*32)
print("{:^32}".format("S C O R E S"))
print("="*32)
print("Computer: ", computer_score)
print("Player: ", player_score)
if player_score == 10:
print("Congratulations! You win!!")
elif player_score == computer_score:
print("Wohoo!! It\'s a tie. Good game!")
else:
print("Uh oh! You lost the game. Try again!")