def binary_search(input_list,x):
    """Binary search implementation

    :param input_list: an input sorted list of elements
    :param x: a number searched
    :return: index of the number found or -1 if not found
    """
    low,high = 0, len(input_list)-1

    while low <= high:
        mid = (low+high)//2

        if input_list[mid]==x:
            return mid
        elif x > input_list[mid]:
            low = mid+1
        else:
            high = mid - 1
    return -1