- Kids drink toddy.
- Teens drink coke.
- Young adults drink beer.
- Adults drink whisky.

Make a function that receive age, and return what they drink.

**Rules:**

- Children under 14 old.
- Teens under 18 old.
- Young under 21 old.
- Adults have 21 or more.

**Examples:**

```python
people_with_age_drink(13) == "drink toddy"
people_with_age_drink(17) == "drink coke"
people_with_age_drink(18) == "drink beer"
people_with_age_drink(20) == "drink beer"
people_with_age_drink(30) == "drink whisky"
```

Difficulty: introductory

Starter code:

def people_with_age_drink(age):
	

Solutions:
def people_with_age_drink(age):
    if age > 20: return 'drink whisky'
    if age > 17: return 'drink beer'
    if age > 13: return 'drink coke'
    return 'drink toddy'

def people_with_age_drink(age):
    if age <= 13:
        beverage = 'toddy'
    elif age > 13 and age <= 17:
        beverage = 'coke'
    elif age > 17 and age <= 20:
        beverage = 'beer'
    elif age > 20:
        beverage = 'whisky'
    return 'drink ' + beverage

def people_with_age_drink(age):
    return 'drink ' + ('toddy' if age < 14 else 'coke' if age < 18 else 'beer' if age < 21 else 'whisky')

def people_with_age_drink(age):
    for a in [[21,'whisky'],[18,'beer'],[14,'coke'],[0,'toddy']]:
        if age >= a[0]:
            return "drink {0}".format(a[1])

people_with_age_drink = lambda a, d=['toddy','coke','beer','whisky']: 'drink '+d[(a>13)+(a>17)+(a>20)]

def people_with_age_drink(age):
    dic = {tuple(range(0,14)):"drink toddy", tuple(range(14,18)):"drink coke", tuple(range(18,21)):"drink beer"}
    return  dic.get(max(i if age in i else (0,0) for i in dic), "drink whisky") 
 


def people_with_age_drink(age):
    if age < 14:
        return "drink toddy"
    elif age >= 21:
        return "drink whisky"
    elif age < 18:
        return "drink coke"
    elif age >=18<21:
        return "drink beer"

def people_with_age_drink(age):
    return 'drink toddy'*(age<14) or 'drink coke'*(age<18) or 'drink beer'*(age<21) or 'drink whisky'

def people_with_age_drink(age):
    drinks = {1:'drink toddy',2:'drink coke',3:'drink beer',4:'drink whisky'}
    return drinks[1] if age<14 else drinks[2] if age<18 else drinks[3] if age<21 else drinks[4]

def people_with_age_drink(age):
    drinks = {age<14:'toddy',14<=age<18:'coke',18<=age<21:'beer',age>=21:'whisky'}
    return 'drink {}'.format(drinks[True])

def people_with_age_drink(age):
    return 'drink %s' % ('toddy' if age < 14 else 'coke' if 13 < age < 18 \
    else 'beer' if 17 < age < 21 else 'whisky')

def people_with_age_drink(age):
    return 'drink {}'.format('toddy' if age < 14 else 'coke' if 18 > age >= 14 else 'beer' if 21 > age >= 18 else 'whisky')

def people_with_age_drink(a):
    return "drink " + ("toddy" if a < 14 else "coke" if a < 18 else "beer" if a < 21 else "whisky")

def people_with_age_drink(age):
    return "drink toddy" if age<14 else "drink coke" if age<18 else "drink beer" if age<21 else "drink whisky"

drinks = [
    ("whisky", 21),
    ("beer", 18),
    ("coke", 14),
]
def people_with_age_drink(age):
    return "drink " + next((drink for drink, age_limit in drinks if age >= age_limit), "toddy")

def people_with_age_drink(age):
    return 'drink ' + next(d for a, d in [
        (21, 'whisky'), (18, 'beer'), (14, 'coke'), (0, 'toddy')
        ] if age >= a)

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif age >= 14 and age < 18:
        return 'drink coke'
    elif age >= 18 and age < 21:
        return 'drink beer'
    else:
        return 'drink whisky'
    return 'ERROR....WRONG INPUT'

people_with_age_drink = lambda n: "drink %s" % ('toddy' if n < 14 else 'coke' if n < 18 else 'beer' if n < 21 else 'whisky')

def people_with_age_drink(age: int) -> str:
    """ Get what people should drink based on their age. """
    return f"drink {'toddy' if age < 14 else 'coke' if age < 18 else 'beer' if age < 21 else 'whisky'}"

def people_with_age_drink(age):
    if age < 14: return "drink toddy"
    if age < 18: return "drink coke"
    if age < 21: return "drink beer"
    return "drink whisky"

def people_with_age_drink(age):
    for (lim, drink) in [(14,"toddy"), (18, "coke"), (21, "beer"), (float('inf'), "whisky")]:
        if age < lim:
            return "drink " + drink

def people_with_age_drink(age):
    return ["drink toddy", "drink coke", "drink beer", "drink whisky"][(age >= 21) + (age > 17) + (age > 13)]
    


from bisect import bisect
def people_with_age_drink(age):
    r = {
        0: "drink toddy",
        1: "drink coke",
        2: "drink beer",
        3: "drink whisky"
    }
    return r[bisect([14, 18, 21], age)]

people_with_age_drink=lambda a: 'drink '+("toddy" if a<14 else "coke" if a<18 else "beer" if a<21 else "whisky")

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif age < 18:
        return 'drink coke'
    elif age < 21:
        return 'drink beer'
    return 'drink whisky'


def people_with_age_drink(age):
    return 'drink '+('toddy','coke','beer','whisky')[sum(not age<x for x in (14,18,21))]

def people_with_age_drink(age):
    drink = ("toddy", "coke", "beer", "whisky")[(age>=14) + (age>=18) + (age>=21)]
    return "drink {}".format(drink)

def people_with_age_drink(age):
    return ["drink toddy", "drink coke", "drink beer", "drink whisky"][(age>=21) + (age>=18) + (age>=14)]


def people_with_age_drink(age):
  for limit, drink in [(14, "toddy"), (18, "coke"), (21, "beer")]:
    if age < limit:
      return 'drink ' + drink
  return 'drink whisky'

def people_with_age_drink(age):
    a=[(14,'drink toddy'), (18, 'drink coke'), (21, 'drink beer')]
    for i, d in a:
        if age < i:
            return d
    return 'drink whisky'

def people_with_age_drink(age):
    if age < 14: return "drink toddy"
    if age < 18: return "drink coke"
    if age < 21: return "drink beer"
    else: return "drink whisky"

def people_with_age_drink(age):
    drink = ""
    if age < 14:
        drink = "drink toddy"
    elif age <18 and age > 13:
        drink = "drink coke"
    elif age < 21 and age > 17:
        drink = "drink beer"
    else:
        drink = "drink whisky"
    return drink

def people_with_age_drink(age):
    print(age)
    if (age >= 0 and age <= 13):
        return 'drink toddy'
    elif (age >= 14 and age <= 17):
        return 'drink coke'
    elif (age >= 18 and age <=20):
        return 'drink beer'
    else: 
        return 'drink whisky'


def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    if age > 13 and age <18:
        return 'drink coke'
    if age > 17 and age < 21:
        return 'drink beer'
    if age > 20:
        return 'drink whisky'

def people_with_age_drink(age):
    drink = "drink"
    if age < 14:
        drink = "{} toddy".format(drink)
    elif age < 18:
        drink = "{} coke".format(drink)
    elif age < 21:
        drink = "{} beer".format(drink)
    else:
        drink = "{} whisky".format(drink)
    return drink

def people_with_age_drink(age):
    return "drink whisky" if age >= 21 else "drink beer" if 18 <= age <= 20 else "drink coke" if 14 <= age <= 17 else "drink toddy"

def people_with_age_drink(age):
    if age >= 21:
        return 'drink whisky' 
    elif age in range(18,21):
        return 'drink beer' 
    elif age in range(14,18):
        return 'drink coke'
    elif age in range(0,14):
        return 'drink toddy' 

def people_with_age_drink(age):
    if age >=21:
        return "drink whisky"
    else:
        if age < 21 and age >=18:
            return "drink beer"
        else:
            if age < 18 and age >= 14:
                return "drink coke"
            else:
                return "drink toddy"


def people_with_age_drink(age):
    if 0 <= age <= 13:
        return "drink toddy"
    elif 14 <= age <= 17:
        return "drink coke"
    elif 18 <= age <= 20:
        return "drink beer"
    else:
        return "drink whisky"

def people_with_age_drink(age):
    if age >= 21:
        return ('drink whisky')
    if age < 21 and age >= 18:
        return 'drink beer'
    if age < 14:
        return 'drink toddy'
    if age >= 14 and age < 18:
        return 'drink coke'

drink_pairs = {'kid':'toddy','teen':'coke','youngAdult':'beer','adult':'whisky'}

def people_with_age_drink(age):
    if age >= 21:
        return 'drink ' + drink_pairs['adult']
    elif age < 21 and age >= 18:
        return 'drink ' + drink_pairs['youngAdult']
    elif age < 18 and age >= 14:
        return 'drink ' + drink_pairs['teen']
    else:
        return 'drink ' + drink_pairs['kid']

def people_with_age_drink(age):
    return "drink toddy" if age <14 else "drink coke"\
if 13<age<18 else "drink beer" if 17<age<21 else "drink whisky"

def people_with_age_drink(age):
    if age <= 13:
        return "drink toddy"
    elif age <18 > 13:
        return "drink coke"
    elif age < 21 > 17:
        return "drink beer"
    elif age >= 21:
        return "drink whisky"
    else:
        pass

def people_with_age_drink(age):
    res='drink {}'
    if age<14:
        return res.format('toddy')
    elif age<18:
        return res.format('coke')
    elif age<21:
        return res.format('beer')
    return res.format('whisky')


def people_with_age_drink(age):
    if not(age) > 13:
        return 'drink toddy'
    elif age > 13 and not (age) >= 18:
        return 'drink coke'
    elif age >= 18 and not (age) > 20:
        return 'drink beer'
    else:
        return 'drink whisky'

def people_with_age_drink(age):
    if age < 14:
        drink = "toddy"
    elif 14 <= age < 18:
        drink = "coke"
    elif 18 <= age < 21:
        drink = "beer"
    else:
        drink = "whisky"
    return "drink"+ " " + drink

def people_with_age_drink(age):
    if age<14:
        return "drink toddy"
    elif age<18:
        return "drink coke"
    elif age<21:
        return "drink beer"
    elif age>=21:
        return "drink whisky"
    else: 
        return "error"

def people_with_age_drink(age):
    if age >= 0 and age < 14:
        return "drink toddy"
    elif age < 18:
        return "drink coke"
    elif age < 21:
        return "drink beer"
    elif age >= 21:
        return "drink whisky"
    else:
        return "not a meaningful age"

def people_with_age_drink(age):
    print(age)
    if age < 14:
        return 'drink toddy'
    elif 13 < age < 18: 
        return 'drink coke'
    elif 17 < age < 21: 
        return 'drink beer'
    elif age > 20: 
        return 'drink whisky'

def people_with_age_drink(age):
    if age < 14:
        return "drink toddy"
    if age<18 and age>13:
        return "drink coke"
    if age<21 and age>=18:
        return "drink beer"
    if age>=21:
        return "drink whisky"

def people_with_age_drink(age):
    if age <= 13:
        return 'drink toddy'
    elif age <= 17 and age >= 14:
        return 'drink coke'
    elif age >= 21:
        return 'drink whisky'
    else:
        return 'drink beer'

def people_with_age_drink(age):
    result = ""
    if(age < 14 ):
        result = "drink toddy"
    if(age >= 14 and age < 18):
        result = "drink coke"
    if(age >= 18 and age <= 21):
        result = "drink beer"
    if(age >= 21 ):
        result = "drink whisky"
    return result

def people_with_age_drink(age):
    a, b, c = 14, 18, 21
    if age < a:
        return 'drink toddy'
    if a <= age < b:
        return 'drink coke'
    if b <= age < c:
        return 'drink beer'
    if age >= c:
        return 'drink whisky'


def people_with_age_drink(age):
    if age <= 13:
        return "drink toddy"
    elif 14<=age<=17:
        return "drink coke"
    elif 18<=age<21:
        return "drink beer"
    elif age>=21:
        return "drink whisky"

def people_with_age_drink(age):
    if age < 14:
        return "drink toddy"
    if age >= 14 and age <= 17:
        return "drink coke"
    if age >= 18 and age <= 20:
        return "drink beer"
    else:
        return "drink whisky"

def people_with_age_drink(age):
    res = ""
    if age < 14:
        res = "drink toddy"
    elif age < 18:
        res = "drink coke"
    elif age < 21:
        res = "drink beer"
    else:
        res = "drink whisky"
    return res

people_with_age_drink = lambda x: 'drink toddy' if x < 14 else 'drink coke' if x < 18 else 'drink beer' if x < 21 else 'drink whisky'

def people_with_age_drink(age):
    return "drink " + ("toddy" if age<14 else "coke" if 13<age<18 else "beer" if 17<age<21 else "whisky")

def people_with_age_drink(age):
    drink = {
        14: 'toddy',
        18: 'coke',
        21: 'beer'
    }
    for d in drink:
        if age < d:
            return 'drink ' + drink[d]
    return 'drink whisky'  

def people_with_age_drink(age):
    drinks = {'Children': "drink toddy",
              'Teens': "drink coke",
              'Young': "drink beer",
              'Adults': "drink whisky"}
    if age < 14:
        return drinks['Children']
    if age < 18:
        return drinks['Teens']
    if age < 21:
        return drinks['Young']
    if age >= 21:
        return drinks['Adults']


def people_with_age_drink(age):
        if age < 14:
            return "drink toddy"
        else:
            if age < 18:
                return "drink coke"
            else:
                if age < 21:
                    return "drink beer"
                else:
                    if age >= 21:
                        return "drink whisky"

def people_with_age_drink(age):
    if age <= 13:
        return "drink toddy"
    elif 13 < age <= 17:
        return "drink coke"
    elif 17 < age <= 20:
        return "drink beer"
    else:
        return "drink whisky"

def people_with_age_drink(a):
    print(a)
    foo = ["drink toddy", "drink coke", "drink beer", "drink whisky"]
    if a >= 18:
        if a < 21:
            return foo[2]
        return foo[3]
    elif a < 18:
        if a < 14:
            return foo[0]
        return foo[1]


def people_with_age_drink(age: int) -> str:
    """ Get what people should drink based on their age. """
    drink_rule = {
        age < 14: "toddy",
        14 <= age < 18: "coke",
        18 <= age < 21: "beer",
        age >= 21: "whisky"
    }
    return f"drink {drink_rule[True]}"

def people_with_age_drink(age):
    drinks = {'toddy': range(14),
              'coke': range(14, 18),
              'beer': range(18, 21),
              'whisky': range(21, 999)}
    for key, age_range in drinks.items():
        if age in age_range:
            return f'drink {key}'

def people_with_age_drink(age):
    if age < 14:
        return "drink toddy"
    elif age <= 17 and age >= 14:
        return "drink coke"
    elif age >= 18 and age <= 20:
        return "drink beer"
    elif age >=21:
        return "drink whisky"

def people_with_age_drink(age):
    
    kids_age = range(0, 14)
    teens_age = range(14, 18)
    youngadults_age = range(18,21)
    
    if age in kids_age: return 'drink toddy'
    elif age in teens_age: return 'drink coke'
    elif age in youngadults_age: return 'drink beer'
    else: return 'drink whisky'

def people_with_age_drink(age):
    drink = ""
    if 0 <= age < 14:
        drink = "drink toddy"
    if 14 <= age < 18:
        drink = "drink coke"
    if 18 <= age < 21:
        drink = "drink beer"
    if 21 <= age:
        drink = "drink whisky"
    return drink

age = people_with_age_drink(0)
print(age)

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif 14 <= age < 18:
        return 'drink coke'
    elif 18 <= age < 21:
        return 'drink beer'
    return 'drink whisky'


def people_with_age_drink(age):
    if age >=21:
        return "drink whisky"
    elif age in range(18,21):
        return "drink beer"
    elif age in range(14,18):
        return "drink coke"
    else:
        return "drink toddy"


def people_with_age_drink(age):
    
    s = ''
    
    if age > 20 :
        s = 'whisky'
    if age < 21 :
        s = 'beer'
    if age < 18 :
        s = 'coke'
    if age < 14 :
        s = 'toddy'
    
    return 'drink ' + s

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif 14 < age < 18:
        return 'drink coke'
    elif 18 < age < 21:
        return 'drink beer'
    elif age == 18:
        return 'drink beer'
    elif age == 14:
        return 'drink coke'
    elif age == 21:
        return 'drink whisky'
    elif age > 21:
        return 'drink whisky'

def people_with_age_drink(age):
    drinks = {"14": "drink toddy", "18": "drink coke", "21": "drink beer", "100": "drink whisky"}
    
    for key in drinks:
        if age < int(key):
            return drinks[key]

def people_with_age_drink(age):
    drinks = ["drink toddy", "drink coke", "drink beer", "drink whisky"]
    if age < 14:
        return drinks[0]
    elif 14 <= age < 18:
        return drinks[1]
    elif 18 <= age < 21:
        return drinks[2]
    else:
        return drinks[3]

def people_with_age_drink(age):
    rv =  'drink '
    if age < 14:
        return rv + 'toddy'
    elif age < 18:
        return rv + 'coke'
    elif age < 21:
        return rv + 'beer'
    else:
        return rv + 'whisky'


def people_with_age_drink(age):
    return 'drink ' + ("toddy" if age < 14 else "coke" if age < 18 else "beer" if age < 21 else "whisky" if age >= 21 else 0)


people_with_age_drink=lambda a:f'drink {(a<14 and "toddy") or (a<18 and "coke") or (a<21 and "beer") or "whisky"}'

def people_with_age_drink(age):
    if age <= 13: 
        return "drink toddy"
    elif age <= 17:
        return "drink coke"
    elif age == 18 or age <= 20:
        return "drink beer"
    elif age > 20:
        return "drink whisky"
    


def people_with_age_drink(age):
    if age in range(0,14):
        return 'drink toddy'
    elif age in range(13,18):
        return 'drink coke'
    elif age in range(18,21):
        return 'drink beer'
    else:
        return 'drink whisky'

def people_with_age_drink(age):
    switcher={
        1: 'drink toddy',
        2: 'drink coke',
        3: 'drink beer',
        4: 'drink whisky'
    }
    if age < 14:  return switcher.get(1,None)
    elif 14 <= age < 18:  return switcher.get(2,None)
    elif 18 <= age < 21:  return switcher.get(3,None)
    elif 21 <= age:  return switcher.get(4,None)

def people_with_age_drink(age):
    if age <= 13:
        return "drink toddy"
    elif age in range(14, 18):
        return "drink coke"
    elif age in range(18, 21):
        return "drink beer"
    elif age >= 21:
        return "drink whisky"


def people_with_age_drink(age):
    if age >= 0 and age < 14:
        return "drink toddy"
    if age >= 14 and age < 18:
        return "drink coke"
    if age >= 18 and age < 21:
        return "drink beer"
    if age >= 21:
        return "drink whisky"

def people_with_age_drink(age):
    if (age < 14):
        return "drink toddy"
    elif ( age <= 17 and age >= 14 ):
        return "drink coke"
    elif ( age > 17 and age <= 20 ):
        return "drink beer"
    elif ( age > 20 ):
        return "drink whisky"
    else:
        return ""

people_with_age_drink = lambda age: f"drink {age < 14 and 'toddy' or age < 18 and 'coke' or age < 21 and 'beer' or 'whisky'}"

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif age >= 14 and age < 18:
        return 'drink coke'
    elif age >= 18 and age < 21:
        return 'drink beer'
    else:
        return 'drink whisky'
    
print(people_with_age_drink(20))

#this function tells you what you should drink based on your age.
def people_with_age_drink(age):
    drink="drink "
    if age<14:
        drink+="toddy"
    elif age<18:
        drink+="coke"
    elif age<21:
        drink+="beer"
    elif age>=21:
        drink+="whisky"
    return drink

def people_with_age_drink(age: int) -> str:
    DRINK_TABLE = ( (21,'whisky'), (18,'beer'), (14,'coke'), (0,'toddy') )
    for limit, drink in DRINK_TABLE:
        if age >= limit:
            return f'drink {drink}'
    return 'no drink'

def people_with_age_drink(age):
    if age < 14:
        return 'drink toddy'
    elif 13 < age < 18:
        return 'drink coke'
    elif 17 < age < 21:
        return 'drink beer'
    elif age > 20:
        return 'drink whisky'

def people_with_age_drink(age):
    
    if age in range(0, 14):
        return "drink toddy"
    elif age in range(14, 18):
        return "drink coke"
    elif age in range(18, 21):
        return "drink beer"
    elif age < 0:
        raise Exception("Incorrect age")
    elif age >= 21:
        return "drink whisky"

def people_with_age_drink(age):
    if age >= 21:
        return 'drink whisky'
    if age >= 18 and age < 21:
        return 'drink beer'
    if age >= 14 and age < 18:
        return 'drink coke'
    if age < 14:
        return 'drink toddy'

    


def people_with_age_drink(age):
    if age<14:
        return "drink toddy"
    elif 14<=age<=17:
        return "drink coke"
    elif 17<age<21:
        return 'drink beer'
    else:
        return 'drink whisky'

def people_with_age_drink(age):
    j = True
    if age < 14: 
        j = 'drink toddy'
    elif age < 18:
        j = 'drink coke'
    elif age < 21:
        j = 'drink beer'
    elif age >= 21:
        j = 'drink whisky'    
    return j

def people_with_age_drink(age):
    if age <= 13:
        return "drink toddy"
    elif age <= 17 and age >= 14:
        return "drink coke"
    elif age <= 20 and age >= 18:
        return "drink beer"
    else:
        if age >= 21:
            return "drink whisky"


def people_with_age_drink(age):
    if age < 14 :
        return 'drink toddy'
    elif age < 18 and age >0:
        return 'drink coke'
    elif age < 21 and age >0:
        return 'drink beer'
    elif age >=21 and age >0:
        return 'drink whisky'

def people_with_age_drink(age):
    if age in range(0,14):
        return "drink toddy"
    elif age in range (14, 18):
        return "drink coke"
    elif age in range (18, 21):
        return "drink beer"
    elif age >= 21:
        return "drink whisky"

def people_with_age_drink(age):
    if age<=13:
        return "drink toddy"
    elif 14<=age<=17:
        return "drink coke"
    elif 18<=age<=20:
        return "drink beer"
    else:
        return "drink whisky"

def people_with_age_drink(age):

    if age < 14:
        drink = "toddy"
    elif 14 <= age <= 17:
        drink = "coke"
    elif 18 <= age <= 20:
        drink = "beer"
    else:
        drink = "whisky"
        
    return "drink {}".format(drink)

def people_with_age_drink(age):
    if age < 14:
        a = 'drink toddy'
    elif age < 18:
        a = 'drink coke'
    elif age < 21:
        a = 'drink beer'
    else:
        a = 'drink whisky'
    return a


def people_with_age_drink(age):
    if age<14:
        return "drink toddy"
    if age<18:
        return "drink coke"
    if age<21:
        return "drink beer"
    if age>14:
        return "drink whisky"