human
Find the point on X | Function to find median of the array.
Sort the given array.
If number of elements are even.
Return the first median.
Otherwise.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to find the point on X and the other steps required.
 def findLeastDist ( A , N ) :
	A . sort ( ) ;
	if ( N % 2 == 0 ) :
		return A [ ( N - 1 ) // 2 ] ;
	else :
		return A [ N // 2 ] ;
A = [ 4 , 1 , 5 , 10 , 2 ] ;
N = len ( A ) ;
print ( " ( " , findLeastDist ( A , N ) , " , ▁ " , 0 , " ) " ) ;