exercise done
This commit is contained in:
1 parent
629429e1f2
commit
55030af64d
1 file changed
+10
-1
@@ -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)
|
||||
Reference in new issue
Block a user