human
Give me a code to program to find whether a given number is power of 2 and the other steps required given the following:
Program to find whether a given number is power of 2 | function which checks whether a number is a power of 2.
base cases '1' is the only odd number which is a power of 2 ( 2 ^ 0 ).
all other odd numbers are not powers of 2.
recursive function call.
Driver Code.
True.
False"
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 powerof2 ( n ) :
	if n == 1 :
		return True
	elif n % 2 != 0 or n == 0 :
		return False
	return powerof2 ( n / 2 )
if __name__ == " _ _ main _ _ " :
	print ( powerof2 ( 64 ) )
	print ( powerof2 ( 12 ) )