input: Write a function to calculate the maximum possible revenue from items with given weights and values using a knapsack approach. The function should take three parameters: weights (a list of integers), values (a list of integers), and n (the number of items). The function should return the maximum revenue. If the number of items (n) is 0, return 0.
  assert knapsack([2, 1, 3], [4, 2, 3], 3)==9
  assert knapsack([1, 2, 3], [6, 10, 12], 3)==22
  assert knapsack([1, 3, 4, 5], [1, 4, 5, 7], 4)==9
  assert knapsack([], [], 0)==0
  assert knapsack([1, 2], [1, 2], 2)==2
output: def knapsack(weights, values, n):
      if n == 0:
          return 0
      dp = [0] * (sum(weights) + 1)
      for i in range(n):
          for w in range(len(dp) - 1, weights[i] - 1, -1):
              dp[w] = max(dp[w], dp[w - weights[i]] + values[i])
      return max(dp)