Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PREVIOUS NEXT
Code Example
Python :: python system arguments 
Python :: pip version command 
Python :: add x axis label python 
Python :: tkinter navigate pages 
Python :: find duplicated rows with respect to multiple columns pandas 
Python :: best games made in pygame 
Python :: special characters list in python 
Python :: python RuntimeWarning: overflow encountered in long_scalars 
Python :: get size of window tkinter 
Python :: how to print numbers from 1 to 20 in python 
Python :: matplotlib plot remove margins 
Python :: python convert file into list 
Python :: How do you sum consecutive numbers in Python? 
Python :: plt.clear 
Python :: get attribute in selenium python 
Python :: how to get variable from setings django 
Python :: django.db.backends.mysql install 
Python :: get current week python 
Python :: cv2 image object to base64 string 
Python :: python pie chart with legend 
Python :: flask development mode 
Python :: trigonometry in python 
Python :: python process id 
Python :: PySpark null or missing values 
Python :: How to develop a TCP echo server, in Python? 
Python :: how to start ftpd server with python 
Python :: get content of one column in pandas 
Python :: get eth balance python 
Python :: converting parquet to csv python 
Python :: list existing virtual envs 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =