Hangman Part 1: Three helper functions
1A) Determine whether the word has been guessed
def is_word_guessed(secret_word, letters_guessed):
'''
secret_word: string, the word the user is guessing; assumes all letters are
lowercase
letters_guessed: list (of letters), which letters have been guessed so far;
assumes that all letters are lowercase
returns: boolean, True if all the letters of secret_word are in letters_guessed;
False otherwise
'''
flag = True
for i in secret_word:
if i not in letters_guessed:
flag = False
break
return flag
1B) Getting the user’s guess
def get_guessed_word(secret_word, letters_guessed):
'''
secret_word: string, the word the user is guessing
letters_guessed: list (of letters), which letters have been guessed so far
returns: string, comprised of letters, underscores (_), and spaces that represents
which letters in secret_word have been guessed so far.
'''
guessed_word = ''
for i in secret_word:
if i in letters_guessed:
guessed_word += i
else:
guessed_word += '_ '
return guessed_word
1C) Getting al