def binarySearch(data, target, low, high):
   #Return True if target is found in indicated portion of a Python list.
   #The search only considers the portion from data[low] to data[high] inclusive.

 if low > high:
     return False # interval is empty; no match
 else:
     mid = (low + high) // 2
     if target == data[mid]: # found a match
        return True
     elif target < data[mid]:
        # recur on the portion left of the middle
        return binarySearch(data, target, low, mid - 1)
     else:
        # recur on the portion right of the middle
        return binarySearch(data, target, mid + 1, high)
data = [5, 10, 15, 20, 25, 30, 40]
target = 20
low = 0
high = 6
result = binarySearch(data, target, low, high)
if result:
    print("The value ", target, " Found")
else:
    print("The value ", target, " Not found")

