Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is the question and the code I tried so far, can someone fix if so the last part of the code adds a new

this is the question and the code I tried so far, can someone fix if so the last part of the code adds a new city to the list and also prints it without square brackets and ''. Without using "for" statements
image text in transcribed
image text in transcribed
In this assignment you'll create a dictionary of Illinois cities and their populations. Use city names as keys and their populations as values. Follow the steps to complete the program. 1) Create an empty dictionary and ask the user to input three cities and their populations, add them to a dictionary, then print the dictionary. ( 5 points) 2) Prompt the user to input a city name and display the population of that city, assuming the city is already in the dictionary. (10 points) 3) Expand your program by allowing the user to add one more city to the dictionary, then output the dictionary. ( 5 points) Example: Input the fixst city: chicago Input the population of the city: 2742119 Input the second city: Aurora Input the population of the city: 183447 Input the third city: Joliet Input the population of the city: 150323 \{'Chicago': 2742119, 'Aurora': 183447, 'Joliet': 150323 \} Input a city to find its population: Chicago The population of Chicago is 2742119 Input the name of the city you want to add: Naperville Input its population: 149013 f'Chicago': 2742119, 'Aurora': 183447, 'Joliet': 150323, 'Naperville': 149013\}

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 Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Is SHRD compatible with individual career aspirations

Answered: 1 week ago