-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuess_the_no.py
37 lines (32 loc) · 1.38 KB
/
Guess_the_no.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import random
print("""
####### #####
# # # ##### ###### # # #### # # ###### ##### # # # # # ####
# # # # # # # # # ## ## # # # # # ## # # #
# # # # ##### ##### # # # ## # ##### # ###### # # # # #
# # ##### # # # # # # # # # # # # # # # ###
# # # # # # # # # # # # # # # # ## # #
# # # ###### ##### #### # # ###### # # # # # # ####
""")
c = random.randrange(1, 101)
def guess_no(rep):
for a in range(rep, 0, -1):
print(f"You have {a} chances left to guess")
# print(c)
u = int(input("make a guess"))
if u == c:
return print("You guessed it correct")
if u > c:
print("Your no. is too big")
else:
print("Your no. is too small")
def final_prog():
repeat = input("choose the difficulty level")
if repeat == 'hard':
guess_no(5)
elif repeat == 'easy':
guess_no(10)
else:
print("please give valid input")
final_prog()
final_prog()