input: Write a function to find the maximum value that can be obtained by selecting items with given values and weights within a knapsack's capacity using dynamic programming. The function should return the maximum value. Write the function header and provide example assertions to validate the function.
  def knapSack(W, wt, val):
      n = len(val)
      dp = [[0 for _ in range(W + 1)] for _ in range(n + 1)]
      
      for i in range(1, n + 1):
          for w in range(1, W + 1):
              if wt[i-1] <= w:
                  dp[i][w] = max(val[i-1] + dp[i-1][w-wt[i-1]], dp[i-1][w])
              else:
                  dp[i][w] = dp[i-1][w]
      
      return dp[n][W]
  
  assert knapSack(50, [10, 20, 30], [60, 100, 120]) == 220
  assert knapSack(10, [1, 2, 3], [1, 2, 3]) == 6
  assert knapSack(7, [1, 3, 4, 5], [1, 4, 5, 7]) == 9
  assert knapSack(100, [], []) == 0
  assert knapSack(0, [10, 20, 30], [60, 100, 120]) == 0
output: def knapSack(W, wt, val):
      n = len(val)
      dp = [[0 for _ in range(W + 1)] for _ in range(n + 1)]
      
      for i in range(1, n + 1):
          for w in range(1, W + 1):
              if wt[i-1] <= w:
                  dp[i][w] = max(val[i-1] + dp[i-1][w-wt[i-1]], dp[i-1][w])
              else:
                  dp[i][w] = dp[i-1][w]
      
      return dp[n][W]