input: Write a python function to calculate the average word length in a sentence.
  assert average_length("This is a sample sentence with 8 words.") == 4.375
  assert average_length("Hello world") == 5.0
  assert average_length("Python programming is fun") == 5.25
output: def average_length(sentence):
      words = sentence.split()
      total_length = sum(len(word) for word in words)
      return total_length / len(words)