Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

decimal to binary in python

a = 10
#this will print a in binary
bnr = bin(a).replace('0b','')
x = bnr[::-1] #this reverses an array
while len(x) < 8:
    x += '0'
bnr = x[::-1]
print(bnr)
Source by www.datacamp.com #
 
PREVIOUS NEXT
Tagged: #decimal #binary #python
ADD COMMENT
Topic
Name
8+5 =