def compute_average_word_length(tokens):
    '\n    Calculate word length for a sentence\n    :param tokens: a list of words\n    :return: The average length of words in this list\n    '
    word_lengths = [len(word) for word in tokens]
    return (sum(word_lengths) / len(word_lengths))
Calculate word length for a sentence
:param tokens: a list of words
:return: The average length of words in this list
def compute_average_word_length(tokens):
    '\n    Calculate word length for a sentence\n    :param tokens: a list of words\n    :return: The average length of words in this list\n    '
    word_lengths = [len(word) for word in tokens]
    return (sum(word_lengths) / len(word_lengths))