Question: Please CREATE and COMMENT the code in python. Please note: you need to use try-except block whenever the need arises for any of the following

Please CREATE and COMMENT the code in python. Please note: you need to use try-except block whenever the need arises for any of the following questions. Dont use tree or linked lists related libraries Thank you  Please CREATE and COMMENT the code in python. Please note: you

2. You are given a 2-D list. Every list has a dish and the ingredients used in it. Your task is to group the dishes by ingredients. Include the dish only if it is made by more than 1 ingredient. Also, the output should be in alphabetical order of the ingredients. You need to write a function for this task. Example: Input "Salad", "Tomato" "Cucumber", "Salad", "Sauce"] ["Pizza", "Tomato", "Sausage, "Sauce", "Dough"], [ "Quesadilla", "Chicken", "Cheese", "Sauce", ["Sandwich", "Salad" "Bread", "Tomato", "Cheese"]] Solution: Output ["Cheese", "Quesadilla", "Sandwich"], ["Salad", "Salad","Sandwich"], ["Sauce", "Pizza", "Quesadilla", "Salad"], ["Tomato", "Pizza", "Salad", "Sandwich" ]] Explanation: 1st element of input list i.e. Salad, Pizza, Quesadilla, Sandwich are names of dishes. The remaining elements are the ingredients used. In the output, 1st element is the ingredient name and the remaining elements are the dishes made from them. Also note that the output is sorted by names of the ingredients

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!