Python list exercize - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Python list exercize (/thread-27039.html) |
Python list exercize - ESTOUR - May-23-2020 Hello I'm in high school(I guess, I Don't really know to what it correspond since I'm french) and I've got this excercize which I can't get through. Here is the translated version : Quote:Exercise 3.2 So, my biggest problem here is the task about taking the biggest loot possible, 'cause it means that you have to associate different valuables in order to make the biggest loot possible whithout exceeding the threshold. And I Don't know how to do this. That's why I'm asking if you could help me if it's not too much of a bother. Thanks in advance ! RE: Python list exercize - michael1789 - May-23-2020 Here is a hit: "associate different valuables" list = [(price0, mass0), (price1, mass1), (price2, mass2)] print(list[0][0], list[2][1], list[3][1]) RE: Python list exercize - jefsummers - May-23-2020 One approach - find the value per kg of each item, then select the items with the highest value per kg keeping under the 22kg limit total. RE: Python list exercize - ESTOUR - May-23-2020 Okay thanks, I will try ! |