Question: Specification: hiddenWord and userGuess are both length -5 strings containing lower case letters. The function returns a list L of 5 numbers, each of which

Specification: hiddenWord and userGuess are both length -5 strings containing lower case letters. The function returns a list L of 5 numbers, each of which can be 0,1 , or 2 . For i=0,1,2,3,4, element L[i] will represent the "status" of the letter userGuess[i]. We will use the following rule to assign a status to each letter in userGuess: 0= letter does not appear in hiddenWord 1 = letter appears in hiddenWord, but not in the correct position 2= letter appears in hiddenWord in the correct position Examples: evaluateWord("snake", "boats") should return [0, 0, 2, 0, 1] evaluateWord("stole", "broom") should return [0, 0, 2, 1, 0] Note: If a letter in userGuess appears in hiddenWord in both matching and non-matching positions, then its status should be 2. Example: evaluateWord("slots", "boats") should return [0, 1, 0, 2, 2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
