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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
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.
Transcribed Image Text: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.
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)
What is the largest population for a small town? 1000000
Transcribed Image Text: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) What is the largest population for a small town? 1000000
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT