Hangman is a word game in which computer will randomly select a word from the dictionary and player has to guess it correctly in given number of turns. The word to be guessed is represented by row of stars. If the guessed letter is present is word, script will automatically be placed to correct places.
Rules to guess the word :
- Input single letter in one turn.
- Don’t use repeated letters.
- Turns will be decremented after every guess.
This is the text file used inside the code words.txt, which contains 50,000 English words.
Module needed :
Below is the implementation :
* * * * * Word has 5 letters Total turns: 11 Enter your guess: a Turns left 10 ********** Enter your guess: i Turns left 9 i **i**i**** Enter your guess: s Turns left 8 s **i**i**ss Enter your guess: r Turns left 7 **i**i**ss Enter your guess: h Turns left 6 **i**i**ss Enter your guess: e Turns left 5 e **i**i*ess Enter your guess: o Turns left 4 **i**i*ess Enter your guess: u Turns left 3 u *ui**i*ess Enter your guess: t Turns left 2 t *ui*ti*ess Enter your guess: n Turns left 1 n *ui*tiness Enter your guess: l Turns left 0 l *uiltiness Word is: guiltiness
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Hangman Game in Python
- Conway's Game Of Life (Python Implementation)
- Python implementation of automatic Tic Tac Toe game using random number
- Color game using Tkinter in Python
- Python | Program to implement Jumbled word game
- Python | Catching the ball game
- Python | Program to implement simple FLAMES game
- Python | Simple FLAMES game using Tkinter
- 21 Number game in Python
- Python program for word guessing game
- Python | Pokémon Training Game
- Mastermind Game using Python
- Number guessing game in Python 3
- Introduction to pyglet library for game development in Python
- Number Guessing Game in Python using Binary Search
- Tic Tac Toe Game using PyQt5 in Python
- 2048 Game in Python
- Create a Simple Two Player Game using Turtle in Python
- Create pong game using Python - Turtle
- A Game of Anagrams in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.