Question: Write a Python program that creates the dictionary containing the information about the picnic. Starting with an empty dictionary, do the following: Prompt the user

Write a Python program that creates the dictionary containing the information about the picnic. Starting with an empty dictionary, do the following:

  • Prompt the user to enter the name of a person bringing food.
  • Prompt the user to enter the name of the food that person is bringing.
  • Prompt the user to enter how many of that food that person is bringing.
  • Add that information to the dictionary.
  • Return to the top and repeat.

You can assume that the user will not enter the same name/food combination more than once. Continue looping and adding information until the user enters an empty string for the name. At that point, print the dictionary (you can just print it, you don't need to make it pretty).

So, for example, if the user enters 'Scott', 'chicken wings', and 12 as the first entries, the dictionary would look like this afterwards: { 'Scott' : { 'chicken wings' : 12 } }.

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!