input: Write a function to calculate the maximum, minimum, and average values from a given sequence of numbers. The function should return these values in a tuple in the order of maximum, minimum, and average. If the sequence is empty, the function should return None for all three values.
  
  def calculate(nums):
      if not nums:
          return None, None, None
      maximum = max(nums)
      minimum = min(nums)
      average = sum(nums) / len(nums)
      return maximum, minimum, average
  
  assert calculate([3, 4, 5, 1, 2]) == (5, 1, 3.0)
  assert calculate([3, 5, 10, 1, 2]) == (10, 1, 4.2)
  assert calculate([4, 3, 1, 2]) == (4, 1, 2.5)
  assert calculate([3, 5, 4, 1, 2]) == (5, 1, 3.0)
  assert calculate([]) == (None, None, None)
output: def calculate(nums):
      if not nums:
          return None, None, None
      maximum = max(nums)
      minimum = min(nums)
      average = sum(nums) / len(nums)
      return maximum, minimum, average