-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPS.py
More file actions
47 lines (34 loc) · 702 Bytes
/
RPS.py
File metadata and controls
47 lines (34 loc) · 702 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
36
37
38
39
40
41
import random
cont = 1
def opp():
opp_hand = randint(1,3)
return opp_hand
def you():
count = 0
good = ["rock", "paper", "scissors"]
while count == 0:
you_hand = input("Rock, Paper, or Scissors?").lower()
if you_hand not in good:
print("That was not a valid submission.")
count += 1
return good.index(you_hand) + 1
def check():
if opp() == you():
print("Tie!")
elif opp() > you():
print("You lose!")
print("You win!")
def replay():
count2 = 0
while count2 == 0:
rep = input("Play again? (y/n)")
if rep.lower == "n":
cont -= 1
count2 += 1
elif rep.lower == "y":
cont += 0
count2 += 1
else:
print("Not valid.")
def playgame():
if cont == 1: