Question: For this question, we would like to implement a simple word-guessing game. Your program should begin with a welcome message. Be creative here and draw

For this question, we would like to implement a simple word-guessing game. Your program should begin with a welcome message. Be creative here and draw an ASCII art picture (the exact picture is up to you). The program should then take a random word from a predefined list. You can copy and paste this into your code (and add a few more words of your choice no swear words, please!): Word_list = ['apple','alias','alloy','banana','bongo','bogey','category','chains'] It will then ask for alphabetical guesses until the whole word has been guessed. A sample run of your program should look like this (the bold text represents user input): Since this will be a more extensive program, we break our task into functions: Create a function called get_secret that randomly chooses the secret word and returns a String. This function should be used (called) in the main program, storing the result in a variable called secret. You may also want to keep a variable called display_string that keeps track of the users progress in the game. Initially, display_string should be a string of n underscores ( _ ) with n equal to the length of the secret word.

Create a function called display_guess that takes two parameters: the display_string and the number of missed guesses so far, displays them on the screen, and then asks for the users next guess (see figure above). This function should also check if the users guess is one letter long. If not, it should ask for a new guess; otherwise, it should return the new guess.

Create a function called new_display_string that takes in three parameters: the secret string, the display_string, and the users guess (one letter). After the user's guess, the function should return a string corresponding to the new display_string. For example, in the third iteration of the game shown in the above figure: the secret word is BANANA the display_string is _A_A_A the user guess is N After executing the function new_display_string, the return value should be: _ANANA

In your main program, you should create a loop to keep track of the following: The secret word, The display_string: which keeps track of the users progress , The number of missed guesses , The number of total guesses taken (including correct ones) .

Also, in your main program, you should use the functions that you created above whenever possible (hint: the display_guess and new_display_string functions should be executed many times and hence should be inside a loop)

answer in python3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!