input: Write a function to calculate the length of each word in a list.
  assert word_lengths(['cat', 'dog', 'kangaroo', 'tiger']) == {'cat': 3, 'dog': 3, 'kangaroo': 8, 'tiger': 5}
  assert word_lengths(['apple', 'banana', 'cherry']) == {'apple': 5, 'banana': 6, 'cherry': 6}
  assert word_lengths([]) == {}
output: def word_lengths(words):
      return {word: len(word) for word in words}