Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview This is a review assignment where you will use multiple tools you have picked up so far throughout the course. If you're confused about

Overview
This is a review assignment where you will use multiple tools you have picked up so far throughout the course. If you're confused about how to do something make sure you look back at earlier assignments.
In this program you will start by declaring an empty dictionary named population_dict. Then you will use a while-loop to prompt a user for a series of cities and their populations, storing the input in population_dict. After this you will prompt the user to decide what is the maximum population for a city to be considers a small down. Finally, you will open a file called populationdata.txt where you will write the results.
Expected Output
Example of standard out (the console):
What is next city? (enter q to quit) Long Beach
What is the population of Long Beach? 362000
What is next city? (enter q to quit) Los Angeles
What is the population of Los Angeles? 382000000
What is next city? (enter q to quit) San Diego
What is the population of San Diego? 136000000
What is next city? (enter q to quit) Irvine
What is the population of Irvine? 302000
What is next city? (enter q to quit) Detroit
What is the population of Detroit? 606000
What is next city? (enter q to quit) q
What is the largest population for a small town? 1000000
Example of populationdata.txt:
Big Cities:
Los Angeles,382000000
San Diego,136000000
Small Towns:
Long Beach,362000
Irvine,302000
Detroit,606000
Specifications
You should submit a single file called M9A1.py
It should follow the submission standards outlined here: Submission Standards
Your program must declare an empty dictionary named population_dict.
Your program must populate population_dict within a while loop using the input() function to collect input from the user.
Your program must use print() statements to write to a file in the same directory named populationdata.txt.
You are not required to use try/exeception.
Tips and Tricks
There are multiple ways to do this assignment. If you break it down into pieces you'll be fine.
Hard-Coded
Nothing is hard-coded for this file.

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_2

Step: 3

blur-text-image_3

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions