forked from kidscancode/intro-python-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrps.py
More file actions
36 lines (26 loc) · 704 Bytes
/
Copy pathrps.py
File metadata and controls
36 lines (26 loc) · 704 Bytes
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
# KidsCanCode - Intro to Programming
# Rock/Paper/Scissors game
import random
choices = ['r', 'p', 's']
player_wins = ['pr', 'rs', 'sp']
player_score = 0
computer_score = 0
while True:
player_move = input("Your move? ")
if player_move == 'q':
break
computer_move = random.choice(choices)
print("You:", player_move)
print("Me:", computer_move)
combo = player_move + computer_move
if player_move == computer_move:
print("Tie!")
elif combo in player_wins:
print("You win!")
player_score += 1
else:
print("You lose!")
computer_score += 1
print("SCORES:")
print("You: ", player_score)
print("Me: ", computer_score)