-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathGuess_the_number.py
More file actions
100 lines (99 loc) · 3.18 KB
/
Guess_the_number.py
File metadata and controls
100 lines (99 loc) · 3.18 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
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
90
91
92
93
94
95
96
97
98
99
100
import random
import time
print('Welcome to Guess The Number game!')
time.sleep(3)
print('What difficulty would you like to play in?')
time.sleep(1)
print('\n')
print('1 for Very Easy')
print('2 for Easy')
print('3 for Moderate')
print('4 for Hard')
print('5 for Very Hard')
print('6 for Impossible')
print('\n')
while True:
diff = int(input('Enter Difficulty: '))
print('\n')
print('Type a random number and we will tell if your number is higher or lower than the number you have to guess')
print('\n')
if diff == 1:
x = random.randint(0, 10)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You Won!')
time.sleep(2)
break
if diff == 2:
x = random.randint(0, 50)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You Won!')
time.sleep(2)
break
if diff == 3:
x = random.randint(0, 100)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You Won!')
time.sleep(2)
break
if diff == 4:
x = random.randint(0, 500)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You just beat the hard level!')
time.sleep(2)
break
if diff == 5:
x = random.randint(0, 1000)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You just beat the very hard level!')
time.sleep(2)
break
if diff == 6:
x = random.randint(0, 10000)
while True:
y = int(input('Enter your number: '))
if y > x:
print('Your number is bigger')
elif x > y:
print('Your number is smaller')
elif y == x:
print('Congratulations, You just beat the impossible level!')
time.sleep(2)
break
print('Would you like to continue (Yes or No)')
z = input().lower()
if z == 'yes':
continue
elif z == 'no':
print('\n')
print('Thanks for playing this game!')
break