Skip to content

Commit 9c3cdf6

Browse files
Add files via upload
Enter- 1) stone for Stone 2) paper for Paper 3) scissor for Scissor
1 parent 34e8be4 commit 9c3cdf6

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Stone, Paper and Scissor.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import random
2+
3+
print("Welcome to the Stone, Paper, Scissor Game")
4+
5+
# User choise
6+
while True:
7+
wincom = 0
8+
winuser = 0
9+
for i in range(1, 6):
10+
print("\nRound", i, "Start")
11+
user = input("1) Stone\n2) Paper\n3) Scissor\nChoose one option: ")
12+
if user == "stone":
13+
print("You selected Stone")
14+
elif user == "paper":
15+
print("You selected Paper")
16+
elif user == "scissor":
17+
print("You selected Scissor")
18+
else:
19+
exit("Program Failed")
20+
break
21+
22+
# Computer choise
23+
computer = random.choice(["Stone", "Paper", "Scissor"])
24+
print("Computer selected", computer)
25+
if (user == "stone" and computer =="Paper") or (user == "paper" and computer == "Scissor") or (user == "scissor" and computer == "Stone"):
26+
print("Computer won!")
27+
wincom += 1
28+
elif (user == "stone" and computer =="Scissor") or (user == "paper" and computer == "Stone") or (user == "scissor" and computer == "Paper"):
29+
print("You won!")
30+
winuser += 1
31+
elif (user == "stone" and computer =="Stone") or (user == "paper" and computer == "Paper") or (user == "scissor" and computer == "Scissor"):
32+
print("It's a draw!")
33+
else:
34+
print("Program Failed")
35+
36+
if wincom > winuser:
37+
print(f"\nMatch Over\nYou Lose!\nScores: Computer {wincom} Your {winuser}")
38+
elif wincom < winuser:
39+
print(f"\nMatch Over\nYou won!\nScores: Computer {wincom} Your {winuser}")
40+
elif wincom == winuser:
41+
print(f"\nMatch Over\nIt's a draw!\nScores: Computer: {wincom}, You: {winuser}")
42+
user_choise = input("\nPlay Again? (Yes/Exit): ")
43+
if user_choise == 'yes':
44+
continue
45+
else:
46+
break

0 commit comments

Comments
 (0)