Mastery check
Foundation Rep~4 min

Write: total a bill

menu is a dict mapping item names (strings) to prices (ints). order is a list of item names, possibly with repeats.

Write bill(menu, order) that returns the total price of the order. Items that are not on the menu are skipped: they add nothing.

bill({'tea': 4, 'cake': 5}, ['tea', 'pie', 'tea']) → 8

No labels here: choosing the approach is part of what this tests. The skills it trains show once you pass.

main.pylearnPython