Skip to content

Commit fbdd9ae

Browse files
authored
Create rock_paper_scissors.py
1 parent 1a3f78d commit fbdd9ae

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

rock_paper_scissors.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Starting Out with Python (4th Edition).
2+
# Tony Gaddis.
3+
# Page 306.
4+
# Q. 21 Rock, Paper, Scissors Game.
5+
6+
from random import *
7+
8+
MIN = 1
9+
MAX = 3
10+
11+
print("----- ROCK, PAPER, SCISSORS GAME. -----")
12+
print("PRESS \n 1) Rock. \n 2) Paper. \n 3) Scissors.")
13+
14+
m = 1
15+
16+
while m == 1:
17+
x = randint(1,3)
18+
u = int(input("user = "))
19+
20+
if x == 1 and u == 3:
21+
print("Rock Smashes Scissors.")
22+
print("You Lost...")
23+
print("Enter 1 to Start Again...")
24+
m = int(input())
25+
26+
elif u == 3 and x == 2:
27+
print("Scissors Cuts Paper.")
28+
print("You Won...")
29+
print("Enter 1 to Start Again...")
30+
m = int(input())
31+
32+
elif u == 2 and x == 1:
33+
print("Paper Wraps Rock.")
34+
print("You Won...")
35+
print("Enter 1 to Start Again...")
36+
m = int(input())
37+
38+
elif x == 3 and u == 1:
39+
print("Rock Smashes Scissors.")
40+
print("You Won...")
41+
print("Enter 1 to Start Again...")
42+
m = int(input())
43+
44+
elif u == 2 and x == 3:
45+
print("Scissors Cuts Paper.")
46+
print("You Lost...")
47+
print("Enter 1 to Start Again...")
48+
m = int(input())
49+
50+
elif u == 1 and x == 2:
51+
print("Paper Wraps Rock.")
52+
print("You Lost...")
53+
print("Enter 1 to Start Again...")
54+
m = int(input())
55+
56+
else:
57+
print("Same Choice.")
58+
print("Enter 1 to Start Again...")
59+
m = int(input())

0 commit comments

Comments
 (0)