How to convert decimal to binary in Python
![how to convert decimal to binary in python](https://pythonpoint.net/wp-content/uploads/2020/11/how-to-convert-decimal-to-binary-in-python-1024x576.jpg)
A decimal number can be converted to its binary equivalent by using built-in method. Let’s go through these in this article.
Using built-in function bin()
#prints the binary of the decimal number with '0b' in the beginning. print (bin(16)) #prints the binary of the decimal number by replacing '0b' with '' print(bin(16).replace('0b',''))
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-2020-11-19-065720.jpg)
Subscribe
Login
Please login to comment
0 Discussion