-
Notifications
You must be signed in to change notification settings - Fork 87
/
number_guess.py
44 lines (33 loc) · 1.15 KB
/
number_guess.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
38
39
40
41
42
43
44
from random import *
def start_message():
print("************************************************************")
print("** You have to guess number (Hint: in between 1-100) **")
print("************************************************************")
print()
def random_number():
number = round(random() * 100)
if (number):
return number
else:
random_number()
def try_to_find_number(number, user):
if (number == user):
print("Well done!")
print("You found it!")
print("Goodbye!")
return
elif (number < user):
print("Is lower than that one, lets try again!")
user = eval(input("Lets try to find number imagined >> "))
try_to_find_number(number, user)
else:
print("Is higher than that one, lets try again!!")
user = eval(input("Lets try to find number imagined >> "))
try_to_find_number(number, user)
return user
def main():
number = random_number()
start_message()
user = eval(input("Lets try to find number imagined >> "))
try_to_find_number(number, user)
main()