def hasPairWithSum(arr,target): for i in range(len(arr)): if ((target-arr[i]) in arr[i+1:]): return True return False