The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
q
Objectives:
Instructions:
write a program that reads data from a file and shows a report to the user in python.
Program Specification
Here is a link to a data file:
WorldData2012.txt
that contains population and land area data for hundreds of countries (and other geo-political units) adapted from this web site (Links to an external site.). Each line in the file contains the name of a country, the population, and the land area, in that order. Your job is to write a program that analyzes this data in various ways and shows a report to the user. Here is what the program output should include:
Note: land area is given is square kilometers (sq. km.), and "population density" is defined as "population per square kilometer."
Development Tips:
- The first time you read through the file, include an accumulator that allows you to determine the average of the population densities of all the countries. Just calculate the population density for each country as you go, and then use the normal "find the average" pattern to determine the average value.
- Read through the file a second time and use "sifting" operations to fill in the two lists.
-----------