ls = [24, 65, 23, 85, 6, 23, 52, 64, 98, 75, 12]
x = eval(input('input the finding num: '))
low = 0
high = len(ls) - 1
# 二分法的前提是数字序列已经按顺序排列
ls.sort()
print('After sorted,the ls become:',ls)
while low <= high:
mid = int((low + high) / 2)
if ls[mid] > x:
high = mid
elif ls[mid] < x:
low = mid
elif ls[mid]==x:
print('finded x !')
print('x is the {}th number in ls after sorted'.format(mid+1))
break