-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathguess_the_number_part2.py
More file actions
34 lines (32 loc) · 1.05 KB
/
guess_the_number_part2.py
File metadata and controls
34 lines (32 loc) · 1.05 KB
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
#hey welcome to the game show
count = 0
print(''' So are you ready for the game....
Choose a number between 0 and 100...
don't tell me just keep it with you ''')
rules = '''1. if i guess the number larger then your say "too far"
2. if i guess the number smaller then your say "too small"
3. if i guess it correctly don't forget to say "founded".
'''
game = [i for i in range(0,100)]
print(rules)
while(True):
print("is it : ",game[int(len(game)/2)])
try:
user = input("is it: ")
if(user == "too far"):
game = game[0:int(len(game)/2)]
count = count + 1
elif(user == "too small"):
count = count + 1
game = game[int(len(game)/2):]
elif(user == "founded"):
count = count + 1
break
else:
print("pls enter values as per the rules")
continue
except:
print("that was against rules man...")
continue
print(f'''i finally founded your number...
you are way too smart it took me {count} chances to guess it.''')