Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. Write a python program that creates a dictionary whose keys are names (strings) and whose value for a key is a list of the
4. Write a python program that creates a dictionary whose keys are names (strings) and whose value for a key is a list of the favorite foods of the person with that name. Your program should prompt for and input a name and a favorite food until the user enters an empty string for the name. After creating the dictionary, the program prints one line per dictionary entry consisting of the name, the word "likes" and the favorite foods of the person with that name as show in the example below (user input underlined) Enter a sequence of names followed by a favorite food, terminating input by hitting enter for the name Name: John Food: chocolate Name: Karen Food: dates Name: John Food: merlot Name: Karen Food: sauternes Name: John Food: steak Name John likes chocolate, merlot, and steak Karen likes dates and sauternes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started