-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_rock_paper_scissors.py
More file actions
60 lines (52 loc) · 1.66 KB
/
01_rock_paper_scissors.py
File metadata and controls
60 lines (52 loc) · 1.66 KB
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
from random import randint
player_wins = 0
computer_wins = 0
winning_score = 3
while player_wins < winning_score and computer_wins < winning_score:
print("PLAYER SCORE: {} COMPUTER SCORE {} ".format(player_wins,computer_wins))
print("...ROCK...")
print("...PAPER...")
print("...SCISSORS...")
player = input("(ENTER PLAYER 1's CHOICE :)").lower()
if player == "quit" or player == "q":
break
rand_num = randint(0,2)
if rand_num == 0:
computer = "rock"
elif rand_num == 1:
computer = "paper"
else:
computer = "scissors"
print("Computer plays {}" .format(computer))
if player ==computer:
print("It's a tie")
elif player == "rock":
if computer == "scissors":
print("player wins")
player_wins += 1
elif computer == "paper":
print("computer wins")
computer_wins += 1
elif player == "paper":
if computer == "rock":
print("player wins")
player_wins += 1
elif computer == "scissors":
print("computer wins")
computer_wins += 1
elif player == "scissors":
if computer == "paper":
print("player wins")
computer_wins += 1
elif computer == "rock":
print("computer wins")
computer_wins += 1
else:
print("something went wrong")
if player_wins > computer_wins:
print("CONGRATS, YOU WON!")
elif player_wins == computer_wins:
print("It's a tie")
else:
print("OH NO :/ THE COMPUTER WON!")
print("FINAL SCORES: Player {} Computer: {}".format(player_wins,computer_wins))