The 'Hangman' game python code testing
Question: I have written this code for the Hangman game in which the opponent is the
computer. But I keep getting errors that I do not know how to solve. please
take a look for me. For example, my current error is:

    
    
    Traceback (most recent call last):
      File "C:\Users\User\Desktop\Python code\hangmangame_test.py", line 112, in <module>
        hangman(a)
      File "C:\Users\User\Desktop\Python code\hangmangame_test.py", line 91, in hangman
        if isWordGuessed(secretWord, lettersGuessed) == "True":
      File "C:\Users\User\Desktop\Python code\hangmangame_test.py", line 12, in isWordGuessed
        if i in lettersGuessed:
    TypeError: argument of type 'NoneType' is not iterable
    

* * *
    
    
    import string
    def isWordGuessed(secretWord, lettersGuessed):
        '''
        secretWord: string, the word the user is guessing
        lettersGuessed: list, what letters have been guessed so far
        returns: boolean, True if all the letters of secretWord are in lettersGuessed;
          False otherwise
        '''
        # FILL IN YOUR CODE HERE...
        new = ""
        for i in secretWord:
            if i in lettersGuessed:
                new += i
                if new == secretWord:
                    return True
            else:
                return False
    
    def getGuessedWord(secretWord, lettersGuessed):
        '''
        secretWord: string, the word the user is guessing
        lettersGuessed: list, what letters have been guessed so far
        returns: string, comprised of letters and underscores that represents
          what letters in secretWord have been guessed so far.
        '''
        # FILL IN YOUR CODE HERE...
        result = list(secretWord)
        for i in result:
            if i not in lettersGuessed:
                result[result.index(i)] = " _ "
        transtring = ''.join(result)
        return transtring
    
    
    def getAvailableLetters(lettersGuessed):
        '''
        lettersGuessed: list, what letters have been guessed so far
        returns: string, comprised of letters that represents what letters have not
          yet been guessed.
        '''
        # FILL IN YOUR CODE HERE...
        Alletters = string.ascii_lowercase
        result = list(Alletters)
        for i in lettersGuessed:
            if i in result:
                result.remove(i)
        transtring = ''.join(result)
        return transtring
    
    
    
    def hangman(secretWord):
        '''
        secretWord: string, the secret word to guess.
    
        Starts up an interactive game of Hangman.
    
        * At the start of the game, let the user know how many 
          letters the secretWord contains.
    
        * Ask the user to supply one guess (i.e. letter) per round.
    
        * The user should receive feedback immediately after each guess 
          about whether their guess appears in the computers word.
    
        * After each round, you should also display to the user the 
          partially guessed word so far, as well as letters that the 
          user has not yet guessed.
    
        Follows the other limitations detailed in the problem write-up.
        '''
        # FILL IN YOUR CODE HERE...
        print("Welcome to the Hangman game!")
        print('\n')
        print("My word has " + str(len(secretWord)) + " letters!")
        guesses = 8      # No. of guesses
        lettersGuessed = []   # Creating empty list
        Alletters = string.ascii_lowercase    # String containing all the lowercase letters
        while guesses > 0:    # Game starts
            print("You have " + str(guesses) + " guesses left!")
            print("Available letters: " + str(Alletters))
            letters = input("Please guess a letter: ")
            if type(letters) != str:
                print("Invalid input! please enter one letter!")
            else:
                letterslower = letters.lower()     # Transfering input into lowercase
                lettersGuessed = lettersGuessed.append(letterslower)  # Inserting inputs into a list
                if letterslower not in Alletters:
                    print("Opps! you have already guessed that letter: " + getGuessedWord(secretWord, lettersGuessed))
                else:
                    if isWordGuessed(secretWord, lettersGuessed) == "True":
                        print("Congradualation! you won!")
                    else:
                        print("Good guess: " + getGuessedWord(secretWord, lettersGuessed))
                        guesses -= 1
                        Alletters = getAvailableLetters(lettersGuessed)
        print("You have ran out of guess, the word is " + str(secretWord))
    
    
    
    
    
    
    
    # a = "puck"
    # b = ["f", "a", "c", "t"]
    # print(isWordGuessed(a, b))
    # print(getGuessedWord(a, b))
    # print(getAvailableLetters(b))
    
    a = "junior"
    hangman(a)
    


Answer: line 87 : `lettersGuessed.append(letterslower)` instead of `lettersGuessed =
lettersGuessed.append(letterslower)`

Append does not return anything

