exercise done

This commit is contained in:
julien committed 2026-10-15 21:22:27 +02:00
1 parent 629429e1f2
commit 55030af64d
1 file changed
+10 -1
+10 -1
View File
@@ -36,5 +36,14 @@ meals = [
]
def meal_totals(meals)
# À compléter.
total = {}
meals.each do |meal|
unless total.key?(meal[:food])
total[(meal[:food])] = 0
end
total[(meal[:food])] += meal[:quantity]
end
total
end
puts meal_totals(meals)