peterpete

How to solve this python question? I can't figure out at all...this one is stubborn

Discussion created by peterpete on Feb 28, 2014
Latest reply on Mar 2, 2014 by xander_bakker
def average_word_length(text):
    """ (list of str) -> float

    Precondition: text is non-empty. Each str in text ends with \n and at
    least one str in text contains more than just \n.

    Return the average length of all words in text. Surrounding punctuation
    is not counted as part of the words.

    >>> text = ['James Fennimore Cooper\n', 'Peter, Paul and Mary\n']
    >>> average_word_length(text)
    5.142857142857143
    """

Outcomes