PY
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
import random;
times = 0;
n = random.randint(1,30);
print ("guess the number, Enter \"quit\" to exit");
while True :
number = input("enter a number between 0 and 30")
if number == 'quit':
print ("goodbye")
break ;
if(not number.isdigit()) :
print ("Not up to specificatin,start again")
continue
times += 1
x = int(number )
if n == x:
print ("goodjob,the number is:",x)
print ("guess the "+str(times)+"times ")
break
elif n > x:
print (x,'big')
elif n < x:
print (x,'small')
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run