data = [28,3,9,14,7,42,21,36]
target = 3
data.sort()
def binary(data,target):
left = 0
right = len(data)-1
while left<=right:
mid = (left+right)//2
if data[mid] == target:
return True
elif data[mid]<target:
left = mid + 1
else:
right = mid - 1
return False
print(binary(data, target))
To embed this project on your website, copy the following code and paste it into your website's HTML: