The Question
guess_letter:
(str, str) -> str
The first parameter is the unguessed consonants and the second is the difficulty level. Return the consonant to be guessed next by the computer player. If level is EASY, the consonant to guess is randomly selected. If level is HARD, the consonant to guess the first consonant in PRIORITY_CONSONANTS that occurs in the first parameter.
PRIORITY_CONSONANTS = 'tnrslhdcmpfgybwvkqxjz'
EASY = 'E'
HARD = 'H'
Overall this project will create a functional Hangman game, this is one component of it which I have to code myself.
I don’t know how to write this I made a small construct that I wanted to work around. But I honestly don’t understand what to write.
I want that when the difficulty level is hard it to select the first consonant in priority consonants that appears in the parameter unguessed consonants
and when it is easy I want any random consonant to appear
guess_letters(unguessed_consonants, difficulty_level):
if difficulty_level == EASY:
if difficulty_level ==HARD:
In response to the comment by Nadia:
In that case, search_set should be iterated over first: