A commandline game in which the computer selects a random word from the words.txt file, and the player guesses one letter at a time to come up with the full word pronunciation.
If the player makes wrong guesses after two consecutive times, the parts of the body will be hung right from the head to the toes.
If the parts of the body are completely are all hung, the game will be over.
- Random - getting a random word out of the list of words.
- open - opening files.
-
def generate_random_word(file_name:str)
- Generate a random word.
- The argument to be passed will be the filename
-
class HangMan(word)
- The class handles all the syntax of the games as explained in the hang_man.py file code.
- The argument word is a string passed throughout the class methods.
-
main()
- The main function as in the main.py file is used to run all the code in the application.