input: from typing import List
  
  def max_revenue(prices: List[int]) -> int:
      """ Calculate the maximum revenue that can be obtained by buying and selling
      once. The function should find the maximum difference between any two prices
      in the list, where the buying price must come before the selling price.
      >>> max_revenue([10, 7, 5, 8, 11, 9])
      6
      >>> max_revenue([9, 1, 5, 3, 6, 4])
      5
      """
output:     min_price = float('inf')
      max_profit = 0
      for price in prices:
          if price < min_price:
              min_price = price
          elif price - min_price > max_profit:
              max_profit = price - min_price
      return max_profit