Your question is Wordle-Style Guess Evaluation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Retool's app builder includes interactive forms where a five-letter guess can be evaluated against a hidden answer. Given an answer word and a guess word, classify every guess position as green, yellow, or _.
A position is green when the guess has the same letter as the answer at that position. A non-green guess is yellow when the letter appears elsewhere in the answer and has not already been matched by another guess position. Otherwise, mark it _. Duplicate letters must not be matched more times than they occur in the answer. Green matches take priority over yellow matches.
Implement evaluate_guess(answer, guess), where both inputs are lowercase strings of exactly five English letters. Return an array of exactly five strings. Each output element must be one of green, yellow, or _, and corresponds to the same index in guess.
def evaluate_guess(answer, guess):