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',''))