human
First and Last Three Bits | Function to print the first and last 3 bits equivalent decimal number.
Number formed from last three bits.
Let us get first three bits in n.
Number formed from first three bits.
Printing result.
Driver code"
Solution in Python:
assistant
#Here is code to first and Last Three Bits and the other steps required.
 def binToDecimal3 ( n ) :
	last_3 = ( ( n & 4 ) + ( n & 2 ) + ( n & 1 ) ) ;
	n = n >> 3
	while ( n > 7 ) :
		n = n >> 1
	first_3 = ( ( n & 4 ) + ( n & 2 ) + ( n & 1 ) )
	print ( first_3 , last_3 )
if __name__ == " _ _ main _ _ " :
	n = 86
	binToDecimal3 ( n )