human
Program to find whether a given number is power of 2 | Function to check if x is power of 2.
First x in the below expression is for the case when x is 0.
Driver code"
Solution in Python:
assistant
#Here is code to program to find whether a given number is power of 2 and the other steps required.
 def isPowerOfTwo ( x ) :
	return ( x and ( not ( x & ( x - 1 ) ) ) )
if ( isPowerOfTwo ( 31 ) ) :
	print ( ' Yes ' )
else :
	print ( ' No ' )
if ( isPowerOfTwo ( 64 ) ) :
	print ( ' Yes ' )
else :
	print ( ' No ' )