A Hangman game similar to /usr/games/hangman
written as a TDD exercise
get_random_word
- Inputs - No inputs
- Output - Returns a random word from
/usr/share/dict/words
satisfying the following conditions-
Should be atleast 6 letters long
-
Should not have any non alphabetical characters
-
No proper nouns (no words with capital initial letter)
w = hangman.get_random_word() print(w) # might be 'elephant'
-
- ?
- inputs - secret word, guessed letters
- output - Will return a string with
-
-
for letters that have not been guessed -
The actual letter in the correct position for letters than have been guessed
t = x("elephant", []) # t should be "--------" t = x("elephant", ["e"]) # t should be "e-e-----" t = x("elephant", ["e", "a"]) # t should be "e-e--a--" t = x("elephant", ["e", "a", "x"]) # t should be "e-e--a--"
-