from random import randint
from collections import deque

N = randint(0, 100)
#初始化队列,队列长度为5
history = deque([], 5)

def guess(K):
if K == N:
print("right!")
return True
elif K > N:
print("%s is greater-than N" % K)
else:
print("%s is less-than N" % K)
return False

while True:
line = input("please input a number:")
#Python isdigit() 方法检测字符串是否只由数字组成。
if line.isdigit():
k = int(line)
history.append(k)
if guess(k):
break
elif line == 'history' or line == 'h?':
print(list(history))