Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 02e67bc

Browse files
Add files via upload
1 parent 2536ca4 commit 02e67bc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import random
2+
def round(n):
3+
pgm = 0
4+
usr = 0
5+
for i in range(n):
6+
ip=int(input(str(i+1)+". Enter a number(1-3) \n1. Stone\t2. Paper\t3. Scissors : "))
7+
cp=random.randint(1,3)
8+
print(a[cp-1])
9+
if ip==cp:
10+
print("Draw")
11+
elif ip+1==cp or (ip==3 and cp==1):
12+
pgm += 1
13+
print("Computer Scored a point")
14+
15+
elif (ip - 1 == cp or (cp == 3 and ip == 1)):
16+
usr += 1
17+
print("You Scored a point")
18+
else:
19+
print("You entered a wrong Number")
20+
i=i-1
21+
print("Your score :"+str(usr)+"\nComputer Score :"+str(pgm))
22+
print("-----Game Over-----")
23+
24+
a=["stone","paper","scissors"]
25+
n=int(input("how many turns you want in a round?"))
26+
while(True):
27+
round(n)
28+
s=input("Do you want to play again?(Y/N) : ")
29+
if s=='N' or s=='n':
30+
break
31+
print("-----Thank you-----")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /