input: Write a function to calculate the maximum possible revenue from items with given weights and values. The function should take three parameters: a list of weights, a list of values, and the number of items. The function should return the maximum revenue that can be achieved given a specific capacity of the knapsack.
  assert knapsack([2, 1, 3], [4, 2, 3], 3) == 7
  assert knapsack([1, 3, 4, 5], [1, 4, 5, 7], 4) == 9
  assert knapsack([10, 20, 30], [60, 100, 120], 3) == 220
  assert knapsack([], [], 0) == 0
  assert knapsack([5], [4], 1) == 4
output: def knapsack(weights, values, n):
      capacity = sum(weights)
      dp = [0] * (capacity + 1)
      
      for i in range(n):
          for w in range(capacity, weights[i] - 1, -1):
              dp[w] = max(dp[w], dp[w - weights[i]] + values[i])
      
      return max(dp)