1

I know this is kind of weird question. I was developing a program, and suddenly I got stuck a bit strange issue. Let me explain the portion, where I am having an issue:

I have int type list variable, where I stored binary values like enter image description here

Now I want to take as it is and to convert into Decimal format. How should I do it?

1

1 Answer 1

0

You first need to turn the integer to string than again to int using base 2.

Here is an example:

x = 111000111100000
dec = int(str(x), 2)
print(dec)  # --> 29152
Sign up to request clarification or add additional context in comments.

1 Comment

It worked, thanks alot. Please mark my question up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.