关于TypeError: list indices must be integers or slices, not float报错
def binary_search(list,item):
low = 0
high = len(list) - 1
while low <= high:
mid=(low+high)/2
guess=list[mid]
if guess == item:
return mid
if guess > item:
high = mid - 1
e.
原创
2022-04-26 19:53:24 ·
695 阅读 ·
1 评论