def binarySearch(alist, key, lo, hi):
    
    if lo > hi:
        return -1

    mid = (lo + hi)//2

    if alist[mid] == key:
        return mid
    elif alist[mid] < key:
        return binarySearch(alist, key, mid+1, hi)
    else:
        return binarySearch(alist, key, lo, mid-1)

if __name__ == '__main__':
    list = [4, 23, 35, 101, 456, 1029]

    find23 = binarySearch(list, 23, 0, len(list)-1)
    print(find23)