β back to unit
Medium
# power tools medium
Fair Share of Candy
After the great candy trade, the playground rule is simple: everyone must end up with the SAME total. π¬
You get the haul as name:candies events (a name can appear several times β add them up). Print fair if every kid's total is equal, otherwise unfair.
Example:
Input: haul = ["mia:3", "leo:2", "mia:1", "leo:2"]
Output: fair
Mia's total is 3 + 1 = 4 and leo's total is 2 + 2 = 4 β equal, so it's fair.
π‘ need a hint?
pt-fair-share.pyπ given lines are locked β write your code in between
loading...