input: 
  from typing import List
  
  def max_revenue(weights: List[int], values: List[int], max_capacity: int) -> int:
      """Calculate the maximum possible revenue from the items with given weights and values
      given a maximum capacity for the knapsack.
      >>> max_revenue([2, 1, 3], [4, 2, 3], 5)
      7
      >>> max_revenue([3, 2, 4], [4, 3, 5], 6)
      7
      """
      n = len(weights)
      K = [[0 for _ in range(max_capacity + 1)] for _ in range(n + 1)]
      
      for i in range(n + 1):
          for w in range(max_capacity + 1):
              if i == 0 or w == 0:
                  K[i][w] = 0
              elif weights[i - 1] <= w:
                  K[i][w] = max(values[i - 1] + K[i - 1][w - weights[i - 1]], K[i - 1][w])
              else:
                  K[i][w] = K[i - 1][w]
      
      return K[n][max_capacity]
  
output:     n = len(weights)
      K = [[0 for _ in range(max_capacity + 1)] for _ in range(n + 1)]
      
      for i in range(n + 1):
          for w in range(max_capacity + 1):
              if i == 0 or w == 0:
                  K[i][w] = 0
              elif weights[i - 1] <= w:
                  K[i][w] = max(values[i - 1] + K[i - 1][w - weights[i - 1]], K[i - 1][w])
              else:
                  K[i][w] = K[i - 1][w]
      
      return K[n][max_capacity]