def avg_word(sentence):
    """
    avg_word - calculates the average word length of a sentence
    """
    words = sentence.split()
    num_words = len(words)
    if num_words == 0:
        num_words = 1
    return sum(len(word) for word in words) / num_words