Ad

In the game of dota2 you can either play in two modes: solo (alone) or in a party (with a group of 2+ players). The outcome of these games is either a win or a loss. You gain or lose MMR (matchmaking rating) accordingly.

If you win a dota2 game while in a party, you gain 20 MMR. You lose 20 MMR if you lose the game.

However, if you win a dota2 game while playing solo then you gain 30 MMR and you lose 30 MMR if you lose.

This is because winning with your friends is considered more difficult.

Write a method that will determine the mmr you would get based on the outcome of the game and the type of mode you are playing.

def mmr(party: bool, win: bool) -> int:
    if party and win:
        return 20
    elif party and not win:
        return -20
    elif not party and win:
        return 30
    else:
        return -30