x No x is not in the phrase V V 1111 11 Secret Phrase Do
Create a Python file called PhraseGame.pyImport the provided DrawScoreboard.py module.Be sure to place the module in your development directory so that the import can find the file, then import it as import “” where “” is the name of the Python file without “.py”Write a function called display_guessed_letters() with the following signature:def display_guessed_letters(guessed_letters):This function should:Take an input parameter, a string of lowercase letters representing all guessed letters. You can assume: The input string will contain no spaces, digits, or other forms of punctuationThe letters are not necessarily in sorted order, but all characters will be unique. (There will be no more than one of each character in the parameter)Return the characters from the input string separated by commas, as shown in the example below:Write a function called display_secret_phrase() with the following signature:def display_secret_phrase(secret_phrase, guessed_letters):This function should:Take two input parameters: strings secret_phrase, and guessed_letters secret_phrase is the games’ secret phrase, consisting of upper and lower case letters, apostrophes, and spaces. You can assume secret_phrase contains no characters other than those.guessed_letters follows the same assumptions as the parameter of the same name in display_guessed_letters()Return a string of the guessed letters in the phrase following these specifications: For each letter that is not guessed, display a dashThe spaces and apostrophes are displayed regardless of guessesAll letters in the phrase are guessed for a letter guess and guesses are case insensitive (If it is capitalized in the secret phrase, then it is capitalized in the returned string, regardless of the case of the guess). For example, entering the character ‘A’ or ‘a’ as a guess, matches all letters for ‘A’ (either ‘A’ or ‘a’) in the phrase. “A Black Cat” would have “A –a– -a-” displayed for ‘A’ or ‘a’ and “A –ac- Ca-” for a following guess of ‘C’ or ‘c’Example:Write a function called play_game() with the following signature:def play_game(secret_phrase, total_guesses):This function should:Take two input parameters: A string of the secret phrase and an integer number of guessesThe following steps are repeated until “!” is entered: Print the current scoreboardPrint the secret phrase (the blanks and current guesses)Print the letters guessed so farCheck if the stored guesses contains all the letters in the secret phrase, if so print the win messageCheck if the number of guesses exceeds the total allowed guesses. If so, print the game over messagePrompt the user to enter a character as a guess of a letter in the phrase. The input can either be an upper or lower case letter.After a character is entered: If an “!” is entered, the game ends early, printing a message accordinglyIf the character is a letter (upper or lower case) it will check to see if that letter has already been guessed. If it has not been guessed: store the letter. If the character is not in the phrase, print a message indicating an incorrect guess has been madeIf the character is in the phrase, update the scoreboard and the secret phrase displayIf it has been guessed: print that the letter was a duplicate, then prompt the user to enter another letter.In either case, they are both considered as a valid guess and not stored as an incorrect guessIf any other character is entered, a message is displayed indicating that it is not a valid guess. This also does not result in an incorrect guessThe program following sample outputs demonstrate the flow of execution and the expected output:Win Example:Lose Example:
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.