Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d9af4a9

Browse files
committedOct 30, 2021
creating a script for the game
1 parent 738264c commit d9af4a9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎guess-the-number/guess-the-number.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1+
import random
12

3+
try:
4+
lb = int(input("Enter the lower limit>>"))
5+
ub = int(input("Enter the upper limit>>"))
6+
number = random.randint(lb, ub+1)
7+
while True:
8+
guess = int(input("Enter your guess>>"))
9+
if guess<number:
10+
print("go higher")
11+
elif guess>number:
12+
print("go lower")
13+
elif guess==number:
14+
break
15+
16+
print("Congrats! You guessed the number.")
17+
except:
18+
pass

0 commit comments

Comments
 (0)
Please sign in to comment.