Convert decimal to binary in Python
Advertisements
We can use bin()
to convert a given decimal number into its binary equivalent.
print(bin(1)) #0b1 print(bin(22)) #0b10110 print(bin(2312)) #0b100100001000