>>> from amabon import * >>> lcost = [['Hanna', ('fork', 12)], ['Beth', ('knife', 4), ('glass', 3)], ... ['Peter', ('glass', 6), ('fork', 6), ('knife', 6), ('spoon', 6)]] >>> dprices = {'glass': 3, 'fork': 5, 'knife': 8, 'spoon': 5} >>> amabon(lcost, dprices) >>> for cost in lcost: ... cost ['Hanna', ('fork', 12), 60] ['Beth', ('knife', 4), ('glass', 3), 41] ['Peter', ('glass', 6), ('fork', 6), ('knife', 6), ('spoon', 6), 126] >>> lcost1 = [['Hanna', ('book', 2)], ['Beth', ('shoes', 1)], ... ['Alice', ('watch', 2)], ['Peter', ('glass', 6)], ['Beth', ('sheet', 2)]] >>> dprices1 = {'shoes': 60, 'book': 20, 'watch': 120, 'glass': 3, 'sheet': 27} >>> amabon(lcost1, dprices1) >>> lcost1 [['Hanna', ('book', 2), 40], ['Beth', ('shoes', 1), 60], ['Alice', ('watch', 2), 240], ['Peter', ('glass', 6), 18], ['Beth', ('sheet', 2), 54]] >>> lcost2 = [['Hanna', ('book', 2), ('sneakers', 1)], ... ['Beth', ('shoes', 1), ('book', 3), ('t-shirt', 2), ('glass', 4)], ... ['Alice', ('watch', 2), ('carpet', 1), ('glass', 6), ('book', 2)], ... ['Peter', ('glass', 6), ('fork', 6), ('knife', 6), ('spoon', 6)], ... ['Beth', ('sheet', 2), ('towel', 4), ('tablecloth', 1)]] >>> dprices2 = {'shoes': 60, 'book': 20, 't-shirt': 15, 'sneakers': 80, ... 'watch': 120, 'carpet': 100, 'glass': 3, 'fork': 5, 'knife': 8, ... 'spoon': 5, 'sheet': 27, 'towel': 12, 'tablecloth': 28} >>> amabon(lcost2, dprices2) >>> for cost in lcost2: ... cost ['Hanna', ('book', 2), ('sneakers', 1), 120] ['Beth', ('shoes', 1), ('book', 3), ('t-shirt', 2), ('glass', 4), 162] ['Alice', ('watch', 2), ('carpet', 1), ('glass', 6), ('book', 2), 398] ['Peter', ('glass', 6), ('fork', 6), ('knife', 6), ('spoon', 6), 126] ['Beth', ('sheet', 2), ('towel', 4), ('tablecloth', 1), 130]