check if number is power of 2 python

Solutions on MaxInterview for check if number is power of 2 python by the best coders in the world

showing results for - "check if number is power of 2 python"
Aitana
23 Mar 2020
1def is_power_of_two(number : int) -> bool:
2    while number != 1:
3        if number % 2:
4            return False
5        number /= 2
6    return True
queries leading to this page
check if no is power of 4 pythonpython check if x is power of 2ckeck if a number is power of 2 pythonhow to find if one number is power of another in pythonhow to check if number is power of 2 pythoncheck the numer is power of 2 or not in pythonwrite a program to find whether a given number is a power of 2 or not in pythonnumbers which are the power of 2 in pythonnumbers that are power of 2 pythonpython check if number is power of 2how to check if a number is a power of 2 in pythoncheck if a num is a power of two pythonwherever number is power of two numbers in pythonpython check if number power of twopython is power of 2check if a number is power of another number pythoncheck if power of 2 pythoncheck if a number is a power of two pythonpython code to check number power of 2a number is power of 2 or not check in pythonfunction to check if a number is a power of another number in pythonpython find out if number is a power of 2python check if number is a power of 2python determine if number is power of 2how to find out if a number is a power of another number pythonhow to check if a number is a power of 2 python while looppython check if number is power of 3 5cpython code to check if a number is a power of twocheck if number is a power of 2 pythoncheck if a number is a power of another number in pythonhow to check if a number is a power of 2 pythoncheck if number is power of 2 in pythonhow to check if a number is power of 2 in pythonpython check if something is powre of twochekc if number is power of 2 pythoncheck if number is power of 3 pythonis power of 2 pythoncheck if number is a power of 2 python using bitcheck power of 2 in pythoncheck if a number is power of 2 pythoncheck if number is power of 2 pythoncheck if number is power of 2 python