generate functionTue, 14 Feb 2023

Determine if the given number is a power of two and print this power otherwise write no

def power_of_two(n): i = 0 while 2 ** i <= n: if 2 ** i == n: print(i) break i += 1 else: print("no") power_of_two(16)

Questions about programming?Chat with your personal AI assistant