Coders Packet

Hangman Game using Python

By Archisman Bhattacharya

This is a two or more player hangman game in python. It allows each of the players to enter a sentence/movie name while the rest try to guess the correct answer.

Version and modules use:

Python 3

Random module

Os module

Description:

Hangman is a game where one player enters a sentence/movie name and all the other players try to guess it (one letter at a time) within a certain number of guesses.

Every time the players get a wrong guess, one part of a hanging stick figure is drawn. Players need to guess the sentence/movie name before the entire hangman is drawn.

in this python code, we use attempts instead of the hanging man to keep track of guesses. Every wrong guess decreases the no of attempts the player has left by 1 and every time the player makes a correct guess we update the sentence.

This game can be played by two or more players. The code allows one user to enter the sentence. Once they are done entering the sentence the screen is cleared and a sentence containing some of the letters is shown. Now the other players need to start guessing.

The game ends either when the players guess the entire sentence or the number of attempts they have left goes down to 0.

The code has been described properly with comments to help understand it better.

The game runs on the command prompt and not in any separate GUI.

Download project

Reviews Report

Submitted by Archisman Bhattacharya (Archi651)

Download packets of source code on Coders Packet