human
Generate array having differences between count of occurrences of every array element on its left and right | Function to construct array of differences of counts on the left and right of the given array.
Initialize left and right frequency arrays.
Construct left cumulative frequency table.
Construct right cumulative frequency table.
Print the result.
Driver Code.
Function Call"
How can the above be solved in Python?

What is a code to generate array having differences between count of occurrences of every array element on its left and right and the other steps required?
assistant
#Here is code to generate array having differences between count of occurrences of every array element on its left and right and the other steps required.
 def constructArray ( A , N ) :
	left = [ 0 ] * ( N + 1 )
	right = [ 0 ] * ( N + 1 )
	X = [ 0 ] * ( N + 1 )
	Y = [ 0 ] * ( N + 1 )
	for i in range ( 0 , N ) :
		X [ i ] = left [ A [ i ] ]
		left [ A [ i ] ] += 1
	for i in range ( N - 1 , - 1 , - 1 ) :
		Y [ i ] = right [ A [ i ] ]
		right [ A [ i ] ] += 1
	for i in range ( 0 , N ) :
		print ( Y [ i ] - X [ i ] , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	A = [ 3 , 2 , 1 , 2 , 3 ]
	N = len ( A )
	constructArray ( A , N )