Convert Decimal Number to Binary String using Python

bin function

decimalNumber = 20
binaryString = bin(decimalNumber).replace('0b', '')

print(binaryString)

Leave a Comment

Cancel reply

Your email address will not be published.