from typing import Optional


def get_words(filename, limit: Optional[int] = None):
    """
    Takes a .txt file of words spaced by newlines and loads the words into a list of strings

    Optional int argument limit: specify to take only the first words in the list up to limit
    """

    with open(filename, "r") as f:
        words = [line.strip().upper() for line in f.readlines()]
        if not limit:
            return words
        else:
            return words[:limit]