Just write this snippet for my practice of 0-1 Knapsack Problem:

Python