You are playing euchre and you want to know the new score after finishing a hand. There are two teams and each hand consists of 5 tricks. The team who wins the majority of the tricks will win points but the number of points varies. To determine the number of points, you must know which team called trump, how many tricks each team won, and if anyone went alone. Scoring is as follows:
For the team that called trump:
- if they win 2 or less tricks -> other team wins 2 points
- if they win 3 or 4 tricks -> 1 point
- if they don't go alone and win 5 tricks -> 2 points
- if they go alone and win 5 tricks -> 4 points
Only the team who called trump can go alone and you will notice that it only increases your points if you win all 5 tricks.
Your job is to create a method to calculate the new score. When reading the arguments, team 1 is represented by 1 and team 2 is represented by 2. All scores will be stored with this order: { team1, team2 }.
def update_score(score, trump, alone, tricks):
    done = tricks.count(trump)
    mul = 2 if done == 5 and alone else 1
    add = 1 if done in (3, 4) else 2
    winner = trump if done > 2 else (3 - trump)
    return [pts + (add * mul if team == winner else 0) for team, pts in enumerate(score, 1)]
def update_score(score, trump, alone, tricks):
    done = tricks.count(trump)
    mul = 2 if done == 5 and alone else 1
    add = 1 if done in (3, 4) else 2
    winner = trump if done > 2 else (3 - trump)
    return [pts + (add * mul if team == winner else 0) for team, pts in enumerate(score, 1)]