def binary_search(list, item): low = 0 hight = len(list)-1 while low <= hight: mid = int((low + hight) / 2) guess = list[mid] if guess == item: return mid if guess < item: low = mid + 1 else: hight = mid - 1 return None if __name__ == "__main__": test_list = [1,3,7,9,32,89,100] print(binary_search(test_list, 100))