Generate a guess feedback for a given guess against a target word.
Parameters
Name
Type
Description
Default
target
str
The secret word that needs to be guessed.
required
guess
str
The word provided by the player to be compared against the target.
required
corpus
list(optional)
A collection of valid words used for validation. Defaults to minidict.
minidict
Returns
Name
Type
Description
str
A string of digits representing the result for each letter: - ‘0’ : The letter does not exist in the target. - ‘1’ : The letter exists in the target but in a different position. - ‘2’ : The letter is in the correct position.
Raises
Name
Type
Description
TypeError
If target or guess are not strings.
ValueError
If target and guess have different lengths. If the target is not found in the corpus. If the guess is not found in the corpus.