human
Write me a code to given an array A [ ] and a number x , check for pair in A [ ] with sum as x and the other steps required given the following:
Given an array A [ ] and a number x , check for pair in A [ ] with sum as x | function to check for the given sum in the array.
checking for condition.
driver code"
How can the above be solved in Python?
assistant
#Here is code to given an array A [ ] and a number x , check for pair in A [ ] with sum as x and the other steps required.
 def printPairs ( arr , arr_size , sum ) :
	s = set ( )
	for i in range ( 0 , arr_size ) :
		temp = sum - arr [ i ]
		if ( temp in s ) :
			print " Pair ▁ with ▁ given ▁ sum ▁ " + str ( sum ) +
	" ▁ is ▁ ( " + str ( arr [ i ] ) + " , ▁ " + str ( temp ) + " ) "
		s . add ( arr [ i ] )
A = [ 1 , 4 , 45 , 6 , 10 , 8 ]
n = 16
printPairs ( A , len ( A ) , n )