## The Riddle

The King of a small country invites 1000 senators to his annual party. As a tradition, each senator brings the King a bottle of wine. Soon after, the Queen discovers that one of the senators is trying to assassinate the King by giving him a bottle of poisoned wine. Unfortunately, they do not know which senator, nor which bottle of wine is poisoned, and the poison is completely indiscernible.

However, the King has 10 lab rats. He decides to use them as taste testers to determine which bottle of wine contains the poison. The poison when taken has no effect on the rats, until exactly 24 hours later when the infected rats suddenly die. The King needs to determine which bottle of wine is poisoned by tomorrow, so that the festivities can continue as planned.

Hence he only has time for one round of testing, he decides that each rat tastes multiple bottles, according to a certain scheme.


## Your Task

You receive an array of integers (`0 to 9`), each of them is the number of a rat which died after tasting the wine bottles. Return the number of the bottle (`1..1000`) which is poisoned.


**Good Luck!**


*Hint: think of rats as a certain representation of the number of the bottle...*

Difficulty: introductory

Starter code:

def find(r):
	

Solutions:
def find(r):
    return sum(2**i for i in r)

def find(rats):
    """
    The rule the king should use is the following:
        1) Label all bottle from 1 to 1000
        2) Label all rats from 0 to 9
        3) For each rat r, make it drink the bottle b if the binary representation of b has it's rth bit
           is one.
    Reconstruct the label of the poisonned bottle by computing the base-10 representation:
    """
    return sum(map(lambda x: pow(2,x), rats))

def find(r):
    return sum(1<<d for d in r)

def find(r):
    return sum([pow(2,a) for a in r])    
    
    
    
    
    
    



def find(r):
    # Your code here
    a=['0','0','0','0','0','0','0','0','0','0']
    for i in r:
        a[i]='1'
    a.reverse()
    b="".join(a)
    return int(b,2)

find=lambda r:sum(1<<i for i in r)

def find(a):
    return sum(1 << x for x in a)

def find(r):
    dict = {i: 2**i for i in range(10)}
    return sum(dict.get(y) for y in r)

def find(r):
    return sum(2 ** e for e in r)

def find(r):
    x = ''.join(['1' if i in r else '0' for i in range(9, -1, -1)])
    return int(x, 2)