# a function with multiple arguments of different
# types, that returns not NoneType and requires
# a string method

# a function that takes a list of strings and
# a number and returns the number of lowercase
# strings that have that length


# this is how we would write it in CSC108
def count_matches_old(words, length):
    """ (list of str, int) -> int

    Return the number of words in words that
    have length length and are lowercase.

    >>> count_matches_old(['cat', 'CAT', 'cats'], 3)
    1
    >>> count_matches_old(['cat', 'CATS'], 4)
    0
    """

    count = 0

    for word in words:
        if word.islower() and len(word) == length:
            count += 1

    return count


# we'll change how we do our docstrings
# alt-Enter -> Epytext (should only have to do this once)
def count_matches(words, length):
    """ Return the number of words in words that
    have length length and are lowercase.

    @type words: list of str
    @type length: int
    @rtype: int

    >>> count_matches(['cat', 'CAT', 'cats'], 3)
    1
    >>> count_matches(['cat', 'CATS'], 4)
    0
    """

    count = 0

    for word in words:
        if word.islower() and len(word) == length:
            count += 1

    return count
