Paul is an excellent coder and sits high on the CW leaderboard. He solves kata like a banshee but would also like to lead a normal life, with other activities. But he just can't stop solving all the kata!!

Given an array (x) you need to calculate the Paul Misery Score. The values are worth the following points:

kata = 5
Petes kata = 10
life = 0
eating = 1

The Misery Score is the total points gained from the array. Once you have the total, return as follows:

<40        = 'Super happy!'<70   >=40 = 'Happy!'<100  >=70 = 'Sad!'\>=100       = 'Miserable!'

Difficulty: introductory

Starter code:

def paul(x):
	

Solutions:
def paul(x):
    points = {'life': 0, 'eating': 1, 'kata': 5, 'Petes kata': 10}
    misery = sum(map(points.get, x))
    return ['Miserable!', 'Sad!', 'Happy!', 'Super happy!']\
            [(misery<40)+(misery<70)+(misery<100)]

def paul(x):
    val = x.count("kata")*5 + x.count("Petes kata")*10 + x.count("eating")
    return  'Super happy!' if val<40 else 'Happy!' if 40<=val<70 else  'Sad!' if 70<=val<100 else  'Miserable!'

points = {"life": 0, "eating": 1, "kata": 5, "Petes kata": 10}

def paul(lst):
    score = sum(points[activity] for activity in lst)
    return "Super happy!" if score < 40 else "Happy!" if score < 70 else "Sad!" if score < 100 else "Miserable!"

PTS  = {'kata':5, 'Petes kata':10, 'life':0, 'eating':1}
OUTS = ((100,'Miserable!'), (70,'Sad!'), (40,'Happy!'), (0,'Super happy!'))

def paul(lst):
    v = sum(map(PTS.__getitem__, lst))
    return next(s for limit,s in OUTS if v>=limit)

def paul(x):
    dict = {'kata':5, 'Petes kata': 10, 'life': 0, 'eating': 1}
    res = sum(dict.get(i, 0) for i in x)
           
    return 'Super happy!' if res < 40 else 'Happy!' if res < 70 else  'Sad!' if res <100 else 'Miserable!'


paul=lambda x:(lambda y:['Super happy!','Happy!','Sad!','Miserable!'][(y>39)+(y>69)+(y>99)])(sum('le   k    P'.find(e[0])for e in x))   

points = {'kata': 5, 'Petes kata': 10, 'life': 0, 'eating': 1}

def paul(x):
    score = sum(map(points.get, x))
    return (
        'Super happy!' if score < 40 else
        'Happy!' if score < 70 else
        'Sad!' if score < 100 else
        'Miserable!'
    )

def paul(x):
    vals = {'kata':5,'Petes kata':10,'life':0,'eating':1}
    score = 0
    for item in x:
        score += vals[item]
    if score < 40:
        return "Super happy!"
    elif score < 70:
        return "Happy!"
    elif score < 100:
        return "Sad!"
    else:
        return "Miserable!"

def paul(a):
    s = sum(5 if x=='kata' else 10 if x=='Petes kata' else 1 if x=='eating' else 0 for x in a)
    return 'Super happy!' if s<40 else 'Happy!' if s<70 else 'Sad!' if s<100 else 'Miserable!'

def paul(x):
    points=sum({"kata":5,"Petes kata":10,"life":0,"eating":1}[v] for v in x)
    return [[["Miserable!","Sad!"][points<100],"Happy!"][points<70],"Super happy!"][points<40]