Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cookbook(*args):
- all_recipes = {}
- for name, cuisine, ingredients in args:
- if cuisine not in all_recipes:
- all_recipes[cuisine] = {}
- all_recipes[cuisine][name] = ingredients
- result = ""
- for cuisine, recipes in sorted(all_recipes.items(), key=lambda item: (-len(item[1]), item[0])):
- result += f"{cuisine} cuisine contains {len(recipes)} recipes:\n"
- for recipe, ingredients in sorted(recipes.items()):
- result += f" * {recipe} -> Ingredients: {', '.join(ingredients)}\n"
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement