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

Mekdes
  • 1
  • 1
  • 2
  • Can you give an example of what you tried so far? – scottsaenz Jan 22 '20 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)` – Celius Stingher Jan 22 '20 at 19:51
  • 1
    Does this answer your question? [Python string.join(list) on object array rather than string array](https://stackoverflow.com/questions/497765/python-string-joinlist-on-object-array-rather-than-string-array) – G. Anderson Jan 22 '20 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. – AMC Jan 22 '20 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. – AMC Jan 22 '20 at 22:44

0 Answers0