You can try something like this Harsh:
def checkPair(a, n):
s = set()
sum = 0
# Find sum of whole array
for i in range(n):
sum += a[i]
# / If sum of array is not
# even than we can not
# divide it into two part
if sum % 2 != 0:
return False
sum = sum / 2
# For each element arr[i], see if
# there is another element with
# value sum - arr[i]
for i in range(n):
val = sum - a[i]
if a[i] not in s:
s.add(a[i])
# If element exist than
# return the pair
if val in s:
print("Pair elements are",
a[i], "and", int(val))
# Driver Code
a = [2, 11, 5, 1, 4, 7]
n = len(a)
if checkPair(a, n) == False:
print("No pair found")