I am trying to find a target value from a list but its returning None Instead of returning (index value or -1)
class Solution:
    def search(self, nums: List[int], target: int) -> int:
        ub=len(nums)-1
        lb=0
        length=lb+ub
        flag=0
        def find(nums,lb,ub,length,target):
            mid=length//2
            if(lb>ub):
                return -1
            elif(target==nums[mid]):
                return mid
            elif(target<=nums[mid]):
                ub=mid-1
                length=lb+ub
                find(nums,lb,ub,length,target)
            elif(target>=nums[mid]):
                lb=mid+1
                length=lb+ub
                find(nums,lb,ub,length,target)
        find(nums,lb,ub,length,target)
            
Output None
I know there were other solutions but can't understand what causes this error right now
 
    