Answered step by step
Verified Expert Solution
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 populationdict. Then you will use a whileloop to prompt a user for a series of cities and their populations, storing the input in populationdict. 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?
What is next city? enter q to quit Los Angeles
What is the population of Los Angeles?
What is next city? enter q to quit San Diego
What is the population of San Diego?
What is next city? enter q to quit Irvine
What is the population of Irvine?
What is next city? enter q to quit Detroit
What is the population of Detroit?
What is next city? enter q to quit q
What is the largest population for a small town?
Example of populationdata.txt:
Big Cities:
Los Angeles,
San Diego,
Small Towns:
Long Beach,
Irvine,
Detroit,
Specifications
You should submit a single file called MApy
It should follow the submission standards outlined here: Submission Standards
Your program must declare an empty dictionary named populationdict.
Your program must populate populationdict 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 tryexeception
Tips and Tricks
There are multiple ways to do this assignment. If you break it down into pieces you'll be fine.
HardCoded
Nothing is hardcoded for this file.
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