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: 
You can use [bitwise operators](https://wiki.python.org/moin/BitwiseOperators) like this:

```
>>> lst = [0, 1, 0, 0]
 >>> bin(int(''.join(map(str, lst)), 2) << 1)
'0b1000'

```
You can try:

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

```