β back to unit
Medium
# breaking it down medium
The Party Planner
Birthday math: every guest eats 3 slices (pizzas have 8), drinks 1 juice (packs of 6), and the budget is watching. π
You get the guests count, pizza pprice, juice-pack jprice, and the budget. Round pizzas and packs UP. Print pizzas <n>, packs <n>, cost <total>, then within budget or over budget.
Example:
Input: guests = 10, pprice = 12, jprice = 5, budget = 70
Output:
pizzas 4
packs 2
cost 58
within budget
10 guests need 30 slices (10 Γ 3), rounding up to 4 pizzas (30 Γ· 8); they need 10 juices, rounding up to 2 packs (10 Γ· 6). Cost is 4Γ12 + 2Γ5 = 58, which fits the 70 budget.
π‘ need a hint?
brk-party-planner.pyπ given lines are locked β write your code in between
loading...