human
Find the number obtained after concatenation of binary representation of M and N | Utility function to calculate binary length of a number ..
Function to concatenate the binary numbers and return the decimal result.
find binary length of n.
left binary shift m and then add n.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the number obtained after concatenation of binary representation of M and N and the other steps required.
 def getBinaryLength ( n ) :
	length = 0
	while ( n > 0 ) :
		length += 1
		n //= 2
	return length
def concat ( m , n ) :
	length = getBinaryLength ( n )
	return ( m << length ) + n
m , n = 4 , 5
print ( concat ( m , n ) )