Jan-09-2020, 09:26 AM
Hello everyone! I should solve an exercise in python language and I am not able. This is the exercise:
"Create a Python program that processes a series of text files that contain information related to a set of recipes.
File: Apple Pie.txt
Apples, 4
Sugar, 5
Flour, 6
Eggs, 2
File: Spaghetti in white.txt
Spaghetti, 100
Each file is called as a recipe. It contains the ingredients of that recipe. Each ingredient also has a quantity.
1. For each ingredient, print how many recipes it is associated with.
2. Find recipes that share at least 2 ingredients.
3. For each recipe print how many are its ingredients.
4. Find recipes with the same ingredients.
Thanks in advance!
"Create a Python program that processes a series of text files that contain information related to a set of recipes.
File: Apple Pie.txt
Apples, 4
Sugar, 5
Flour, 6
Eggs, 2
File: Spaghetti in white.txt
Spaghetti, 100
Each file is called as a recipe. It contains the ingredients of that recipe. Each ingredient also has a quantity.
1. For each ingredient, print how many recipes it is associated with.
2. Find recipes that share at least 2 ingredients.
3. For each recipe print how many are its ingredients.
4. Find recipes with the same ingredients.
Thanks in advance!