Answers for "how to find out if a number is a power of another number python"

1

check if number is power of 2 python

def is_power_of_two(number : int) -> bool:
    while number != 1:
        if number % 2:
            return False
        number /= 2
    return True
Posted by: Guest on June-02-2021

Code answers related to "how to find out if a number is a power of another number python"

Python Answers by Framework

Browse Popular Code Answers by Language