Target Sub-Array Sum

We are given an array say [1,4,20,3,10,5] and we need to find target sum 33.If target subarray sum is found we need to return True otherwise False.
Here's what i tried but I'm getting False as output.What's wrong in loop?Please help.

def subArraySum(arr,target):
    curr_sum = arr[0]
    s = 0
    for i in range(1,len(arr)):
        if curr_sum == target:
            return True
        elif curr_sum < target:
            curr_sum += arr[i]
            print(curr_sum)
        elif curr_sum > target:
            curr_sum -= arr[s]
            s += 1
    return curr_sum == target
Comments (0)