Mastery check
Foundation Rep~4 min

Write: items under a budget

menu is a dict mapping item names (strings) to prices (ints). limit is an int.

Write affordable(menu, limit) that returns a sorted list of the names of items that cost limit or less.

affordable({'tea': 4, 'cake': 5, 'bun': 2}, 4) → ['bun', 'tea']

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

main.pylearnPython