input: Write a function to calculate the maximum, minimum, and average values from a given sequence of numbers. The function should return these three values as a tuple in the order of maximum, minimum, and average. If the input sequence is empty, the function should return `None` for all three values.
  def calculate_metrics(sequence):
      if not sequence:
          return None, None, None
      maximum = max(sequence)
      minimum = min(sequence)
      average = sum(sequence) / len(sequence)
      return maximum, minimum, average
  
  assert calculate_metrics([3, 4, 5, 6, 21, 8]) == (21, 3, 8.833333333333334)
  assert calculate_metrics([100, -4, 15]) == (100, -4, 37.0)
  assert calculate_metrics([]) == (None, None, None)
  assert calculate_metrics([5]) == (5, 5, 5.0)
output: def calculate_metrics(sequence):
      if not sequence:
          return None, None, None
      maximum = max(sequence)
      minimum = min(sequence)
      average = sum(sequence) / len(sequence)
      return maximum, minimum, average