items = [(,    3.8, 36.0),
         (,    5.4, 43.0),
         (,     3.6, 90.0),
         (, 2.4, 45.0),
         (,  4.0, 30.0),
         (,   2.5, 56.0),
         (,    3.7, 67.0),
         (,  3.0, 95.0),
         (, 5.9, 98.0)]

MAXWT = 15.0

sorted_items = sorted(((value/amount, amount, name)
                       for name, amount, value in items),
                      reverse = True)
wt = val = 0
bagged = []
for unit_value, amount, name in sorted_items:
    portion = min(MAXWT - wt, amount)
    wt     += portion
    addval  = portion * unit_value
    val    += addval
    bagged += [(name, portion, addval)]
    if wt >= MAXWT:
        break

print()
print(.join(% item for item in bagged))
print(% (wt, val))