← back to unit
Challenge
# power tools advanced
The Missing Ingredients
The recipe demands amounts; the pantry has amounts. What do you still need to buy? 🛒
You get the recipe as item:amount pairs, then the pantry the same way (items missing from the pantry count as 0). Print each item where the pantry falls short, alphabetically, space-separated — or ready to bake.
Example:
Input: recipe = "flour:2,eggs:3,sugar:1", pantry = "flour:2,eggs:1"
Output: eggs sugar
flour has enough (2 ≥ 2), but eggs falls short (1 < 3) and sugar is missing entirely (0 < 1) — those two need buying.
💡 need a hint?
pt-missing-ingredients.py🔒 given lines are locked — write your code in between
loading...