forked from DerailedPsyche/hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
guess_the_num.py
89 lines (63 loc) · 1.63 KB
/
guess_the_num.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import random
choice=random.choice(range(21))
def print_pause(msg_to_print):
print(msg_to_print)
time.sleep(2)
def intro(choice):
print("the computer choose a number within the range 20" )
intro(choice)
def try1():
c1=input("i guess the number is ")
if choice == c1:
print("your guess is correct")
else :
print("Incorrect, Try again..")
try1()
def hint1():
if choice%2 == 0:
print("Hint: The number is even")
else:
print("Hint:The number is odd")
hint1()
def try2():
c2=input(" i guess the number is")
if choice == c2:
print("your guess is correct")
else :
print("Incorrect, Try again..")
try2()
def hint2():
if 10<choice<21 :
print("Hint: The number is greater than 10")
elif 0<choice<11 :
print("Hint: The number is smaller than 10")
else :
print("The number is notin the given range")
hint2()
def try3():
c3=input("i guess the number is ")
if choice == c3:
print("your guess is correct")
else :
print("Incorrect, Try again..")
try3()
def hint3():
if choice%3 == 0:
print("Hint: The number is divisible by 3")
else:
print("Hint: The number is not divisible by 3")
hint3()
def last_try():
c4=input("i guess the number is ")
if choice == c4:
print("your guess is correct")
else :
print("Incorrect, you were unable to guess the correct number ")
last_try()
score=int()
def t_score():
if input == choice :
score+=1
t_score()
print("the correct answer is "+ str(choice))
print("the total score is "+ str(score))