import math
##this is a implement of binary_search
def binary_search(target,arr):
    min = 0
    max = len(arr)-1

    while min <= max:
        mid = (min + (max-min))//2
        print(arr[min:max])
        if arr[mid]==target:
            return mid
        elif arr[mid] < target:
            min = mid+1
        else:
            max = mid -1
    return -1

lista = [1,2,3,4,5,6,7,8,9,10]

target = 4

print(binary_search(target,lista))




c712b32b0a59f882446f2ac7e0fdc35c3f8e0414
<mask token>


def binary_search(target, arr):
    min = 0
    max = len(arr) - 1
    while min <= max:
        mid = (min + (max - min)) // 2
        print(arr[min:max])
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            min = mid + 1
        else:
            max = mid - 1
    return -1


<mask token>

<mask token>


def binary_search(target, arr):
    min = 0
    max = len(arr) - 1
    while min <= max:
        mid = (min + (max - min)) // 2
        print(arr[min:max])
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            min = mid + 1
        else:
            max = mid - 1
    return -1


<mask token>
print(binary_search(target, lista))

<mask token>


def binary_search(target, arr):
    min = 0
    max = len(arr) - 1
    while min <= max:
        mid = (min + (max - min)) // 2
        print(arr[min:max])
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            min = mid + 1
        else:
            max = mid - 1
    return -1


lista = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
target = 4
print(binary_search(target, lista))

import math


def binary_search(target, arr):
    min = 0
    max = len(arr) - 1
    while min <= max:
        mid = (min + (max - min)) // 2
        print(arr[min:max])
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            min = mid + 1
        else:
            max = mid - 1
    return -1


lista = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
target = 4
print(binary_search(target, lista))

import math
##this is a implement of binary_search
def binary_search(target,arr):
    min = 0
    max = len(arr)-1

    while min <= max:
        mid = (min + (max-min))//2
        print(arr[min:max])
        if arr[mid]==target:
            return mid
        elif arr[mid] < target:
            min = mid+1
        else:
            max = mid -1
    return -1

lista = [1,2,3,4,5,6,7,8,9,10]

target = 4

print(binary_search(target,lista))



