Hangman Game Using Python
Hangman Game Using Python
PROJECT
ON
HANGMAN GAME
1. Acknowledgement
2. Certificate
3. Introduction
4. Code
5. Output
6.
7.
8.
9.
10.
Acknowledgement
I would like to express my special
thanks of gratitude to my teacher
Ms. Neha Prajapati as well as our
principal Mrs. Renu Sharma who
gave me the golden opportunity to
do this wonderful project on the
topic “Hangman game using
python”, which also helped me in
doing a lot of Research and I came
to know about so many new things
I am really thankful to them.
Secondly I would also like to thank
my parents and friends who helped
me a lot in finalizing this project
within the limited time frame.
Indirapuram Public School
Certificate
This is to certify that _________________________ of
class 12____ roll no__________ has completed his
investigatory project
entitled____________________________________________
_________in computers during the academic year
_______ for the partial fulfilment of his academic
course in the subject of Computer Science.
Sign of sign of
principal Subject teacher
_________
sign of examiner
Hangman Game using python
Hangman Game is a letter guessing game.
In the game of Hangman, a clue word is given by the program that the player has to
guess, letter by letter. The player guesses one letter at a time until the entire word has
been guessed. (In the actual game, the player can only guess 6 letters incorrectly before
losing).
Let’s say the word the player has to guess is “EVAPORATE”. For this exercise, write the
logic that asks a player to guess a letter and displays letters in the clue word that were
guessed correctly. For now, let the player guess an infinite number of times until they get
the entire word. As a bonus, keep track of the letters the player guessed and display a
different message if the player tries to guess that letter again. Remember to stop the
game when all the letters have been guessed correctly! Don’t worry about choosing a
word randomly or keeping track of the number of guesses the player has remaining – we
will deal with those in a future exercise.
_ _ _ _ _ _ _ _ _
Incorrect!
E _ _ _ _ _ _ _ E
...
And so on, until the player gets the word. Here is the source code to do the same in
Python
Code:
import os
import pickle
import time
width = "150"
height = "50"
print ("")
time.sleep(1)
time.sleep(0.5)
word = "pollution"
turns = 10
failed = 0
if char in guesses:
print (char,end="")
else:
failed += 1
if failed == 0:
break
guesses += guess
turns -= 1
# print wrong
print ("Wrong")
if turns == 0:
OUTPUT: