human
Maximum possible difference of two subsets of an array | function for maximum subset diff.
construct hash for positive elements.
calculate subset sum for positive elements.
construct hash for negative elements.
calculate subset sum for negative elements.
Driver Code"
How can the above be solved in Python?

=====
Write me a code to maximum possible difference of two subsets of an array and the other steps required?
assistant
#Here is code to maximum possible difference of two subsets of an array and the other steps required.
 def maxDiff ( arr , n ) :
	hashPositive = dict ( )
	hashNegative = dict ( )
	SubsetSum_1 , SubsetSum_2 = 0 , 0
	for i in range ( n ) :
		if ( arr [ i ] > 0 ) :
			hashPositive [ arr [ i ] ] = hashPositive . get ( arr [ i ] , 0 ) + 1
	for i in range ( n ) :
		if ( arr [ i ] > 0 and arr [ i ] in hashPositive . keys ( ) and hashPositive [ arr [ i ] ] == 1 ) :
			SubsetSum_1 += arr [ i ]
	for i in range ( n ) :
		if ( arr [ i ] < 0 ) :
			hashNegative [ abs ( arr [ i ] ) ] = hashNegative . get ( abs ( arr [ i ] ) , 0 ) + 1
	for i in range ( n ) :
		if ( arr [ i ] < 0 and abs ( arr [ i ] ) in hashNegative . keys ( ) and hashNegative [ abs ( arr [ i ] ) ] == 1 ) :
			SubsetSum_2 += arr [ i ]
	return abs ( SubsetSum_1 - SubsetSum_2 )
arr = [ 4 , 2 , - 3 , 3 , - 2 , - 2 , 8 ]
n = len ( arr )
print ( " Maximum ▁ Difference ▁ = " , maxDiff ( arr , n ) )