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 172 views
1 answer 141 views
3 answers 160 views
2 answers 149 views
1 answer 145 views
1 answer 175 views
...