0

I am not sure the reason I am not getting the desired outcome is because I am missing some sort of data type conversion.

I am trying to convert the array of numbers into a binary value.

Input = [1,1,1,1,0,1]

Desired output= 11101

Thank you

5
  • Can you give an example of what you tried so far? Commented Jan 22, 2020 at 19:51
  • Do you want to basically turn the list into a string with a binary format? Because your list shows only 1 and 0s or are you expecting other values? binary = ''.join(Input) Commented Jan 22, 2020 at 19:51
  • 1
    Does this answer your question? Python string.join(list) on object array rather than string array Commented Jan 22, 2020 at 19:52
  • That looks like a list, not an array, and while saying that you're converting it into a binary value might technically be correct, I think it misrepresents the question. Commented Jan 22, 2020 at 22:43
  • I would edit the title myself in order to make things clearer, but I'm not even sure what the type of the list elements is. Commented Jan 22, 2020 at 22:44

0

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.