input: Write a function to calculate the maximum, minimum, and average values from a given sequence of numbers. The function should be able to handle empty sequences by returning None for all three values. The function should return the maximum, minimum, and average values as a tuple in that order.
  def calculate_metrics(list):
      if len(list) == 0:
          return None, None, None
      maximum = max(list)
      minimum = min(list)
      total = sum(list)
      average = total / len(list)
      return maximum, minimum, average
  assert calculate_metrics([3, 4, 5, 6, 21, 8]) == (21, 3, 8.166666666666666)
  assert calculate_metrics([1, 2, 3, 4, 5]) == (5, 1, 3.0)
  assert calculate_metrics([]) == (None, None, None)
output: def calculate_metrics(list):
      if len(list) == 0:
          return None, None, None
      maximum = max(list)
      minimum = min(list)
      total = sum(list)
      average = total / len(list)
      return maximum, minimum, average