how to convert a binary number to decimal in python code example
Example 1: binary to decimal in python
int(binaryString, 2)
Example 2: 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)
Example 3: binary to decimal python
format(decimal ,"b")