Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

1 What demand is and what affects it.

Answered: 1 week ago