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
- Hangman Game in Python
- 21 Number game in Python
- Color game using Tkinter in Python
- Python | Catching the ball game
- Conway's Game Of Life (Python Implementation)
- Python | Simple FLAMES game using Tkinter
- Python program for word guessing game
- Python implementation of automatic Tic Tac Toe game using random number
- Python | Program to implement Jumbled word game
- Python | Program to implement simple FLAMES game
- Python | Program to implement Rock paper scissor game
- Project Idea | (A Game of Anagrams )
- Python | Merge Python key values to list
- Important differences between Python 2.x and Python 3.x with examples
- Reading Python File-Like Objects from C | 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 firstname.lastname@example.org. 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.