implementation of a knapsack problem using greedy algorithm in python