Collection data type

Could someone kindly clarify why Dictionary is incorrect and List is correct for the question: What is the best collection data type to store several cake recipes (names and ingredients)?

Hi @ladswapnali23

Actually Dictionary is the correct answer.

Explanation:

You can use a Dictionary data type to store several cake recipes with names and ingredients. Each recipe name can be the key, and the corresponding value can be a List of ingredients. This allows you to easily associate a list of ingredients with each cake recipe and retrieve them when needed. Here’s an example of how you can structure the data:

Regards

1 Like

Thank you @Parvathy for the explanation provided.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.