from random import randint
num=randint(1,67)
print 'Guess what I think?'
bingo =False
while bingo==False:
answer = input()
if answer<num:
print '%d is too small!'%answer
if answer>num:
print '%d is too big!'%answer
if answer==num:
print 'Bingo,%d is the right answer!'%num
bingo=True
结果:
Guess what I think?
43
43 is too small!
34
34 is too small!
63
63 is too big!
56
Bingo,56 is the right answer!