human
Check whether the number has only first and last bits set | function to check whether ' n ' is a power of 2 or not.
function to check whether number has only first and last bits set.
Driver program to test above"
Solution in Python:
assistant
#Here is code to check whether the number has only first and last bits set and the other steps required.
 def powerOfTwo ( n ) :
	return ( not ( n & n - 1 ) )
def onlyFirstAndLastAreSet ( n ) :
	if ( n == 1 ) :
		return True
	return powerOfTwo ( n - 1 )
n = 9
if ( onlyFirstAndLastAreSet ( n ) ) :
	print ( ' Yes ' )
else :
	print ( ' No ' )