-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
47 lines (40 loc) · 816 Bytes
/
game.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
import random
def VE():
while True:
try:
z = int(input("Guess: "))
except ValueError:
pass
else:
if x<=0:
continue
else:
return z
def VL():
while True:
try:
x = int(input("Level: "))
except ValueError:
pass
else:
if x<=0:
continue
else:
return x
x=VL()
#print("from the range 1-",x,sep="")
y=random.randint(1,x)
#print("random integer is ",y)
z=VE()
while z!=y:
if z<y:
#print(z,"<",y)
print("Too small!")
z=VE()
else:
#print(z,">",y)
print("Too large!")
z=VE()
else:
#print(z,"=",y)
print("Just right!")