human
Write me a code to print all pairs with given sum and the other steps required given the following:
Print all pairs with given sum | Python3 program for the above approach.
Driver code"
Solution in Python:
assistant
#Here is code to print all pairs with given sum and the other steps required.
 def pairedElements ( arr , sum ) :
	low = 0 ;
	high = len ( arr ) - 1 ;
	while ( low < high ) :
		if ( arr [ low ] + arr [ high ] == sum ) :
			print ( " The ▁ pair ▁ is ▁ : ▁ ( " , arr [ low ] , " , ▁ " , arr [ high ] , " ) " ) ;
		if ( arr [ low ] + arr [ high ] > sum ) :
			high -= 1 ;
		else :
			low += 1 ;
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 3 , 4 , - 2 , 6 , 8 , 9 , 11 ] ;
	arr . sort ( ) ;
	pairedElements ( arr , 6 ) ;