def evaluate_guess(guess: str, mystery: str):
    """Get the partition label for the mystery word given the guess.
    There are 3^n different partitions, where n is the number of characters in
    guess or mystery.

    Args:
        guess: word being guessed
        mystery: candidate for mystery word

    Returns:
        A base 10 integer based on the base 3 output digits of wordle.
        Considers a grey letter to be 0, a yellow letter to be 1, and a green
        letter to be 2.
    """
    output = []
    for i, char in enumerate(guess):
        if mystery[i] == char:
            output.append('2')
        elif mystery[i] != char and char in mystery:
            output.append('1')
        elif char not in mystery:
            output.append('0')
    return int(''.join(output), base=3)