[Python] With the given class below write a function Creation() that takes a list of food items as argument and creates an instance of class Food for each of them. It then returns the list of instances that it has created.
class Food:
def __init__(self, name, taste):
self.name = name
self.taste = taste
Each food item in the list that is passed as argument to Creation() is a tuple of the form ('name', 'taste'). The function Creation() takes the two elements of each tuple and passes them to the initialiser of Food. It then collects the objects returned by the initialiser and adds them to the list that is returned by Creation()
Answers
Answered by
0
Answer:
for best answer go to programming with priyansh
and comment your question there he will give you reply:-)
Explanation:
follow me for not googled answer
and tip of the day
follow Henrystudies on instagram for study tips and productive tips
Similar questions
Social Sciences,
4 months ago
Economy,
4 months ago
English,
8 months ago
Math,
8 months ago
Computer Science,
11 months ago
Chemistry,
11 months ago
Environmental Sciences,
11 months ago