Skip to content

Commit 765b72b

Browse files
prathameshparittechyminati
authored andcommitted
Add files via upload
1 parent 66d307f commit 765b72b

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎guess-the-number.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import random
2+
system = random.randint(0, 10)
3+
score = 100
4+
while True:
5+
try:
6+
player = int(input("guess a no between 1 to 10 \n"))
7+
if player == system:
8+
print("Damn you are genius")
9+
break
10+
11+
elif player > 10:
12+
print("Bro I said 1 to 10")
13+
score -= 10
14+
15+
elif player > system:
16+
print(f"Nope the number is lesser than {player}")
17+
score -= 10
18+
19+
20+
elif player < system:
21+
print(f"Nope the number is greater than {player}")
22+
score -= 10
23+
except:
24+
print("Atleast type a correct spelling")
25+
26+
print(f" So your score is {score}")

0 commit comments

Comments
 (0)