diff --git a/code/python/src/algorithms/rucksack/display.py b/code/python/src/algorithms/rucksack/display.py index a32c4f2..db44910 100644 --- a/code/python/src/algorithms/rucksack/display.py +++ b/code/python/src/algorithms/rucksack/display.py @@ -67,9 +67,12 @@ def display_rucksack( render = lambda r: f'{r:g}'; table = pd.DataFrame({ 'items': items.tolist() + ['----', '∑'], - 'nr': list(map(str, choice)) + ['----', f'{float(sum(choice)):g}'], - 'costs': list(map(render, costs)) + ['----', f'\x1b[92;1m{sum(choice*costs):g}\x1b[0m'], - 'values': list(map(render, values)) + ['----', f'\x1b[92;1m{sum(choice*values):g}\x1b[0m'], + 'nr': list(map(str, choice)) + + ['----', f'\x1b[92;1m{float(sum(choice)):g}\x1b[0m'], + 'costs': list(map(render, costs)) + + ['----', f'\x1b[92;1m{sum(choice*costs):g}\x1b[0m'], + 'values': list(map(render, values)) + + ['----', f'\x1b[92;1m{sum(choice*values):g}\x1b[0m'], }); repr = tabulate( table,