Knapsack in Python