ludus

Recipes to Groceries

ld-0003 · 4 › ████░░░░░░ · text, parsing, aggregation · requires: arrays · oner lambdaless generalized golfed

Your client works at a test kitchen. Each recipe lists its ingredients per serving as text ("3 g Fennel, 5 cups Garlic, ...") plus how many servings they'll make.

Produce the shopping list: each ingredient with the total amount to buy, written as "amount unit" (per-serving amount times servings, summed across recipes). Watch out for units — the same ingredient bought in different units needs separate rows. Row order is up to you.

Work on it

  1. Make a copy of the template — it becomes your private sheet.
  2. Solve it however you like — helper columns and extra tabs are fair game. The one rule: the grader swaps INPUT for other datasets, so never put your own content inside INPUT.
  3. Check yourself against the expected sample output shown in your copy (and below).
  4. Submit below — Share → "anyone with the link, Viewer", paste the link. Your sheet is graded against 2 hidden datasets, so hardcoded answers won't survive.

Sample

Input (Input!A1:C17)

RecipeIngredients Per ServingServings Made
13 g Fennel, 5 cups Garlic, 1 g Olive oil3
21 tsp Shrimp, 3 g Fennel, 2 lbs Onion4
32 cups Apple, 3 g Lamb, 1 cup Garlic2
42 g All purpose flour, 4 g Rice1

Expected output (Answer!A2:B40)

IngredientAmount
All purpose flour2 g
Apple4 cups
Fennel21 g
Garlic2 cup
Garlic15 cups
Lamb6 g
Olive oil3 g
Onion8 lbs
Rice4 g
Shrimp4 tsp

Adapted from "Recipes to Groceries" in the astral.cafe Community Practice Problems sheet.