input: Write a function to calculate the maximum revenue from a list of stock prices where you can buy and sell at most once. Return the maximum revenue that can be achieved.
  
  def max_revenue(prices):
      max_diff = 0
      min_price = prices[0]
      for i in range(1, len(prices)):
          if prices[i] < min_price:
              min_price = prices[i]
          else:
              max_diff = max(max_diff, prices[i] - min_price)
      return max_diff
  
  assert max_revenue([10, 7, 5, 8, 11, 9])==6
  assert max_revenue([7, 1, 5, 3, 6, 4])==5
  assert max_revenue([1, 2, 3, 4, 5])==4
  assert max_revenue([7, 6, 4, 3, 1])==0
  assert max_revenue([])==0
output: def max_revenue(prices):
      if not prices:
          return 0
      max_diff = 0
      min_price = prices[0]
      for i in range(1, len(prices)):
          if prices[i] < min_price:
              min_price = prices[i]
          else:
              max_diff = max(max_diff, prices[i] - min_price)
      return max_diff