Question: Suppose I have a list:

```
lst = [0, 1, 0, 0]

```

How can I make python interpret this list as a binary number 0100 so that `2*(0100)` gives me `01000`?

The only way that I can think of is to first make a function that converts the "binary" elements to corresponding integers(to base 10) and then use bin() function..

Is there a better way?

Answer: 
The accepted answer, joining a string, is not the fastest.

```py
import random

lst = [int(i < 50) for i in random.choices(range(100), k=100)]

def join_chars(digits): 
    return int(''.join(str(i) for i in digits), 2)    

%timeit join_chars(lst) 
13.1 µs ± 450 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

def sum_digits(digits): 
    return sum(c << i for i, c in enumerate(digits)) 

%timeit sum_digits(lst)                                                                                                                                                                                                 
5.99 µs ± 65.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

```

So bit-banging `sum_digits()` comes first by *a factor of x2!*
You can try:

```
l = [0, 0, 1, 0]
num = int(''.join(str(x) for x in l), base=2)

```