input: Write a function to solve a knapsack problem using dynamic programming. The function should take in the capacity of the knapsack, a list of item values, and a list of item weights, and return the maximum value that can be obtained.
  
  def knapsack_dp(capacity, values, weights): 
      n = len(values)
      dp = [[0 for _ in range(capacity + 1)] for _ in range(n + 1)]
      
      for i in range(n + 1):
          for w in range(capacity + 1):
              if i == 0 or w == 0:
                  dp[i][w] = 0
              elif weights[i-1] <= w:
                  dp[i][w] = max(values[i-1] + dp[i-1][w-weights[i-1]], dp[i-1][w])
              else:
                  dp[i][w] = dp[i-1][w]
      
      return dp[n][capacity]
  
  assert knapsack_dp(50, [60, 100, 120], [10, 20, 30]) == 220
  assert knapsack_dp(10, [1, 2, 3], [4, 5, 1]) == 3
  assert knapsack_dp(7, [1, 2, 5, 6], [2, 3, 4, 5]) == 8
  assert knapsack_dp(0, [60, 100, 120], [10, 20, 30]) == 0
  assert knapsack_dp(10, [], []) == 0
output: def knapsack_dp(capacity, values, weights): 
      n = len(values)
      dp = [[0 for _ in range(capacity + 1)] for _ in range(n + 1)]
      
      for i in range(n + 1):
          for w in range(capacity + 1):
              if i == 0 or w == 0:
                  dp[i][w] = 0
              elif weights[i-1] <= w:
                  dp[i][w] = max(values[i-1] + dp[i-1][w-weights[i-1]], dp[i-1][w])
              else:
                  dp[i][w] = dp[i-1][w]
      
      return dp[n][capacity]