def xyz(a,n,L,h):
while L<=h:
mid=L+(h-L)//2
if a[mid]==n:
return mid
elif a[mid]<n:
L=mid+1
else:
h=mid-1
return-1
a=[1,2,3,4,5,6,7,8,9]
n=int(input("Enter a number to search:"))
r=xyz(a,n,0,len(a)-1)
if r!=-1:
print("Element is present at index"+str(r))
else:
print("Not found")
ZGVmIHh5eihhLG4sTCxoKToKICAgIHdoaWxlIEw8PWg6CiAgICAgICBtaWQ9TCsoaC1MKS8vMgogICAgICAgaWYgYVttaWRdPT1uOgogICAgICAgICAgIHJldHVybiBtaWQKICAgICAgIGVsaWYgYVttaWRdPG46CiAgICAgICAgICAgTD1taWQrMQogICAgICAgZWxzZToKICAgICAgICAgICBoPW1pZC0xCiAgICByZXR1cm4tMQphPVsxLDIsMyw0LDUsNiw3LDgsOV0Kbj1pbnQoaW5wdXQoIkVudGVyIGEgbnVtYmVyIHRvIHNlYXJjaDoiKSkKcj14eXooYSxuLDAsbGVuKGEpLTEpCmlmIHIhPS0xOgogICAgcHJpbnQoIkVsZW1lbnQgaXMgcHJlc2VudCBhdCBpbmRleCIrc3RyKHIpKQplbHNlOgogICAgcHJpbnQoIk5vdCBmb3VuZCIp