#二分查找
a=[2,7,1,3,5,8,3,6,7,15,34]
for i in range(len(a)-1):
for j in range(i+1,len(a)):
if a[i]>a[j]:
a[i],a[j]=a[j],a[i]
print(a)
while True:
n=int(input('请输入一个数'))
first=0
last=len(a)
while first<=last:
middle=(first+last)//2
if a[middle]==n:
print(n,'找到了')
exit()#退出程序exit() exit()
if a[middle]>n:
last=middle-1
if a[middle]<n:
first=middle+1
else:
print(n,'没有找到')