Skip to content

Commit a7aa904

Browse files
Add files via upload
1 parent bdf6f2c commit a7aa904

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

rock paper scissor game.py

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import random
2+
3+
rock ='''
4+
---' ____)
5+
(_____)
6+
(_____)
7+
(____)
8+
---.__(___)'''
9+
10+
paper = '''
11+
_______
12+
---' ____)____
13+
______)
14+
_______)
15+
_______)
16+
---.__________)
17+
'''
18+
19+
scissor = '''
20+
_______
21+
---' ____)____
22+
______)
23+
__________)
24+
(____)
25+
---.__(___) '''
26+
27+
ascii_art = [rock, paper, scissor]
28+
29+
30+
def game_start():
31+
32+
user_raw = input ("Enter your choic 0,1 & 2 for Rock, Paper & Scissor respectively")
33+
user = int(user_raw)
34+
35+
36+
if user < 3 :
37+
print ("User Chose"+ascii_art[user])
38+
39+
computer = random.randint(0,2)
40+
print ("Computer Chose"+ascii_art[computer])
41+
42+
if user == computer :
43+
print ("Its Draw")
44+
45+
elif user == 0 or computer == 2:
46+
print ("You Win")
47+
48+
elif computer == 2 or user == 0:
49+
print ("You Loose")
50+
51+
elif user == 0 or computer == 1 :
52+
print ("You Loose")
53+
54+
elif user == 1 or computer == 0 :
55+
print ("You win")
56+
57+
elif user == 1 or computer == 2:
58+
print ("You Loose")
59+
60+
else :
61+
print ("Its Draw")
62+
63+
replay_raw = input ("Enter 0 to Replay and 1 to End")
64+
replay = int(replay_raw)
65+
66+
while replay == 0:
67+
print (game_start())
68+
69+
else :
70+
print ("Thank You for playing")
71+
72+
else :
73+
print ("Invalid Input")
74+
75+
print (game_start())
76+
77+
78+

0 commit comments

Comments
 (0)