limit = 50
boxes = [10, 25, 30, 5, 15]

boxes.sort(reverse=True)

total_weight = 0
count = 0

for box in boxes:
    if total_weight + box <= limit:
        total_weight += box
        count += 1

print(count)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: