import string


def makeWordList(gFile, stopWords):
    """Create a list of words from the file while excluding stop words."""
    speech = [] # list of speech words: initialized to be empty
    for lineString in gFile:
        lineList = lineString.strip(
        string.whitespace).split() # split each line into a list of words and strip whitespace
        for word in lineList:
            word = word.lower() # make words lower case (we consider a word in lowercase and uppercase to be equivalent)
            word = word.strip(string.punctuation) # strip off punctuation
            if (word not in stopWords) and (word not in string.punctuation):
                # if the word is not in the stop word list, add the word to the speech list
                speech.append(word)
    return speech