How to calculate the decimal value from binary value in Python

1 Answer

0 votes
# binary = 11101

decimal = (1*(2**4)) + (1*(2**3)) + (1*(2**2)) + (0*(2**1)) + (1*(2**0))

print(decimal)




'''
run:

29

'''

 



answered Dec 31, 2020 by avibootz

Related questions

1 answer 277 views
1 answer 225 views
3 answers 331 views
2 answers 267 views
1 answer 280 views
1 answer 271 views
...