Question: PYTHON In this problem, the second player will always be the computer, who will be picking a word at random. Implement a function, hangman(), that

PYTHON In this problem, the second player will always be the computer, who will be picking a word at random. Implement a function, hangman(), that will start up and carry out an interactive Hangman game between a player and the computer.

The computer must select a word at random from the list of available words that was provided in words.txt. The functions for loading the word list and selecting a random word have already been provided for you in ps2_hangman.py.

The game must be interactive: it should let a player know how many letters the word the computer has picked contains and ask the user to supply guesses. The user should receive feedback immediately after each guess. You should also display to the user the partially guessed word so far, as well as either the letters that the player has already guessed or letters that the player has yet to guess.

A player is allowed some number of guesses. Once you understand how the game works, pick a number that seems reasonable to you. Make sure to remind the player of how many guesses s/he has left after each turn.

A player loses a guess only when s/he guesses incorrectly.

The game should end when the player constructs the full word or runs out of guesses. If the player runs out of guesses (s/he loses), reveal the word to the player when the game ends.

http://www.codesend.com/view/0414927efee10d11e4e2332887fd9634/

Hints:

You should start by using the provided functions to load the words and pick a random one.

Consider using string.ascii_lowercase.

Consider writing helper functions

Any help is appreciated, thanks

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!