human
What is a good Python function to calculate the average word length in a sentence.
assistant
Here is a Python function to calculate the average word length in a sentence

import re

def _get_avg_word_length(sentence):
    """
    Calculate the average word length in a sentence.
    """
    words = sentence.split()
    return len(words) / len(sentence)

# Enter the string
sentence = "The quick brown fox jumps over the lazy dog"

# Calling the function
print((_get_avg_word_length(sentence)))

#Example Output
# 0.20930232558139536

#Remember to inspect code for bugs.