human
Print 2 | Function to print the coordinates along with their frequency in ascending order.
map to store the pairs and their frequencies.
Store the coordinates along with their frequencies.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to print 2 and the other steps required.
 def Print ( x , y , n ) :
	m = dict ( )
	for i in range ( n ) :
		m [ ( x [ i ] , y [ i ] ) ] = m . get ( ( x [ i ] , y [ i ] ) , 0 ) + 1
	e = sorted ( m )
	for i in e :
		print ( i [ 0 ] , i [ 1 ] , m [ i ] )
x = [ 1 , 2 , 1 , 1 , 1 ]
y = [ 1 , 1 , 3 , 1 , 3 ]
n = len ( x )
Print ( x , y , n )