input: Write a function to calculate the maximum possible revenue from items with given weights and values using the knapsack problem approach. Return the maximum revenue. The function should take three parameters: a list of weights, a list of values, and the number of items. If the number of items is 0, return 0.
  assert knapsack([2, 1, 3], [4, 2, 3], 3)==5
  assert knapsack([1, 2, 3], [10, 15, 40], 3)==65
  assert knapsack([1, 2, 3], [10, 15, 40], 0)==0
  assert knapsack([10, 20, 30], [60, 100, 120], 3)==220
  assert knapsack([], [], 0)==0
output: def knapsack(weights, values, n):
      if n == 0:
          return 0
      dp = [0] * (n + 1)
      for i in range(1, n + 1):
          for j in range(i, n + 1):
              dp[j] = max(dp[j], dp[j - i] + values[i - 1])
      return dp[n]