Coders Packet

Console Hangman game in Python

By Preetha P

Hangman game in Python is implemented using loops. Here, it randomly assign a word to the player, and the player has to guess the word by recommending the letters with a fixed number of attempts.

In this program, it first generates a secret word randomly and gives a hint for that secret word. Now, the player gets the chance to guess a letter that is present in the word. If the guessed letter is True, then it prints out the letter in the specific space, else it gives you the next chance.

If the guessed letter is a number or not a single alphabet or if it was already been guessed, then it gives a prompt message to specify a valid guess.

Here, the number of chances is restricted to limited numbers (length of the word+2).

If the player finds all the letters in the word within a given number of attempts, the player wins. Else, the player loses, and then it shows the answer.




Download project

Reviews Report

Submitted by Preetha P (Preetha11)

Download packets of source code on Coders Packet