Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Glad it helped! If you feel like you don't have any more questions, then please mark your question as resolved (you can do this by replying to my comment and checking the "mark as resolved" checkbox).
You will be given two dictionaries,
recipe
andavailable
.recipe
is a dictionary containing ingredients and the amount of those ingredients needed to bake a cake.available
is a dictionary containing the ingredients that Pete has, and the amount of those ingredients.You should calculate how many cakes Pete can bake using his
available
ingredients.For example, if a cake can be baked using
2 cups of flour + 1 cup of milk
and Pete has6 cups of flour + 3 cups of milk
, then Pete can bake 3 cakes since he has 3x the ingredients. But if Pete has 6 cups of flour and 3 cups of milk instead, then he can only bake two cakes. Despite having 3x the amount of flour, he only has 2x the amount of milk, so he can only bake 2 cakes. Always choose the lowest possible amount. Also, if theavailable
dictionary is missing one or more ingredients from therecipe
dictionary, the answer should logically be 0 - you can't bake a cake without having all the needed ingredients.it's hard to tell because you did not use markdown code highlighting, but from what i see, during the
for
loop, you erase the last most frequent element (vr_digit
) with the next one in case of a tie, before checking which one is greaterYou have to come up with the correct signature for the function yourself, that's part of the task.