-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock-paper-scissors.py
59 lines (53 loc) · 1.14 KB
/
rock-paper-scissors.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
#Rock beats scissors
#Scissors beats paper
#Paper beats rock
import os
again = True
while again:
os.system('clear')
p1 = 0
p2 = 0
valid1 = False
valid2 = False
while not valid1:
p1 = input("p1 rock, paper or scissors? ")
if p1 == "rock":
valid1 = True
os.system('clear')
elif p1 == "paper":
valid1 = True
os.system('clear')
elif p1 == "scissors":
valid1 = True
os.system('clear')
while not valid2:
p2 = input("p2 rock, paper or scissors? ")
if p2 == "rock":
valid2 = True
os.system('clear')
elif p2 == "paper":
valid2 = True
os.system('clear')
elif p2 == "scissors":
valid2 = True
os.system('clear')
if p1 == p2:
print ("exequo!")
elif p1 == "rock":
if p2 == "scissors":
print ("p1 wins")
else:
print ("p2 wins")
elif p1 == "scissors":
if p2 == "paper":
print ("p1 wins")
else:
print ("p2 wins")
elif p1 == "paper":
if p2 == "rock":
print ("p1 wins")
else:
print ("p2 wins")
print ("-------")
if input("type `no` to stop, enter to restart ") == "no":
again = False