I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Hangman

You need to create your own version of the classic game of Hangman. You will need to get a random word out of an array of available words, display the length of the word, give the user X amount of lives and if they guess correctly you need to display the word with the letters they currently know.

You need to validate their input appropriately and remember to make it user friendly! By this i mean display everything nicely and use comments that tell the user what to do. Below is come code to get you started.

Before starting this project you need to do a decomposition and think about what functions you will need. In this solution you need at least three well defined functions. Below are some examples –

# will return a string with all of the letters replaced based on a guess.
def replaceLetter(letter, currentWord)
# checks to see if a letter is in the secret word or not. 
def letterInWord(letter, secretWord)


You need to log in or create an account to submit code!

Leave a Reply

Your email address will not be published. Required fields are marked *

Information