Skip to content

Commit 45ada68

Browse files
Merge pull request Mayank94043626#93 from IncrediblePro/patch-1
Create Stone_Paper_Scissor_Game.py
2 parents dfeca47 + 5f7c014 commit 45ada68

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import random
2+
3+
print("""
4+
______ ______ ______
5+
/ ___/ | __ \ / ___/
6+
| (__ | |__) | | (__
7+
\__ \ | ___/ \__ \
8+
___) | _ | | _ ___) | _
9+
/_____/ |_| |__| |_| /_____/ |_|
10+
""")
11+
12+
print("""
13+
Welcome to Stone Paper Scissor!
14+
""")
15+
16+
print("""
17+
\n\t\t Instructions: \n\tThere will be 10 Matches to be played.
18+
""")
19+
20+
21+
winner = ""
22+
23+
24+
def Game():
25+
userScore, compScore = 0, 0
26+
a = 1
27+
while a <= 10:
28+
print("""
29+
________________________________________________________
30+
""")
31+
print(f"\n \t\tMatch : {a}\n")
32+
user = input("Enter either 'Stone / Paper / Scissor' : ")
33+
computer = random.randint(1, 100)
34+
comp = ""
35+
36+
if computer <= 33:
37+
comp = "Stone"
38+
if computer > 33 and computer <= 66:
39+
comp = "Paper"
40+
if computer > 66 and computer <= 100:
41+
comp = "Scissor"
42+
43+
print(f"""
44+
Computer's choice :{comp}
45+
User's choice :{user}
46+
""")
47+
48+
# Computer
49+
if comp == "Stone" and (user == "Scissor" or user == "scissor"):
50+
compScore = compScore+1
51+
52+
if comp == "Paper" and (user == "Stone" or user == "stone"):
53+
compScore = compScore+1
54+
55+
if comp == "Scissor" and (user == "Paper" or user == "paper"):
56+
compScore = compScore+1
57+
58+
# User
59+
if (user == "Stone" or user == "stone") and comp == "Scissor":
60+
userScore = userScore+1
61+
62+
if (user == "Paper" or user == "paper") and comp == "Stone":
63+
userScore = userScore+1
64+
65+
if (user == "Scissor" or user == "scissor") and comp == "Paper":
66+
userScore = userScore+1
67+
68+
# same
69+
70+
if comp == "Stone" and user == "Stone" or user == "stone":
71+
userScore, compScore = userScore, compScore
72+
73+
if comp == "Paper" and user == "Paper" or user == "paper":
74+
userScore, compScore = userScore, compScore
75+
76+
if comp == "Scissor" and user == "Scissor":
77+
userScore, compScore == userScore, compScore
78+
79+
print(f"""
80+
User Score : {userScore}
81+
Computer : {compScore}
82+
""")
83+
if compScore < userScore:
84+
winner = "User"
85+
print(f"\tLead : {winner}\n")
86+
87+
if userScore < compScore:
88+
winner = "Computer"
89+
print(f"\tLead : {winner}\n")
90+
91+
if compScore == userScore:
92+
winner = "Both"
93+
print(f"\tLead : {winner}\n")
94+
95+
if a == 10:
96+
print(f"\n\t\nGame won by : {winner}\n")
97+
a = a+1
98+
99+
100+
Game()

0 commit comments

Comments
 (0)