Answers for "how to find binary of a number in python"

3

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)
Posted by: Guest on June-02-2020
0

python binary representation of numbers

# get integer version of binary number
int(bin(8)[2:])
Posted by: Guest on May-04-2021

Code answers related to "how to find binary of a number in python"

Python Answers by Framework

Browse Popular Code Answers by Language