How to convert he boolean values into integers

K

krishna

Hi Guys,

I need to convert 1010100110 boolean value to some think like 2345, if
its possible then post me your comment on this

Advanced thanks for all

Narayana perumal.G
 
U

Ulrich Eckhardt

krishna said:
I need to convert 1010100110 boolean value to some think like 2345, if
its possible then post me your comment on this

Yes, sure. You can simply sum up the digit values and then format them as
decimal number. You can also just look up the number:

def decode_binary(input):
for i in range(2**len(input)):
if bin(i)==input:
return str(i)

I Hope I was able to help you with your homework! ;^)

Uli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top