Ask Business Economics Expert

Objectives:

  • specifically work with files, strings, lists, counters, and accumulators

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:

  • the total number of countries in the list
  • the total world population
  • the name and population of the country that has the highest population
  • the name and population of the country that has the lowest population
  • the name and land area of the country that has the greatest land area
  • the name and land area of the country that has the smallest land area
  • the name and population density of the country that has the highest population density
  • the name and population density of the country that has the lowest population density
  • average population density (the average of the population densities of all the countries, not the population density of the planet as a whole)
  • a list of "densely populated countries" (those with a population density that is more than two times the average)
  • a list of "verysparsely populated countries" (those with a population density that is less than 1% of the average)

Note: land area is given is square kilometers (sq. km.), and "population density" is defined as "population per square kilometer."

Development Tips:

  1. Plan your program carefully on paper before you start writing code.  You may find the sample program illustrating the 'split' method to be a useful reference.
  2. How can you convince yourself that your program is producing correct results with such a large data file?  Consider creating a shorter file with the same format for initial testing purposes so that you can verify calculated results by hand.
  3. Here's one way to accomplish the last two tasks: 
  • 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.

Business Economics, Economics

  • Category:- Business Economics
  • Reference No.:- M92235865
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Economics

Standards drive instruction therefore how do standards

Standards "drive instruction," therefore, how do standards influence curriculum planning?

Explain how the application of the pdca cycle can support a

Explain how the application of the PDCA cycle can support a competitive strategy of low cost leadership.

Ford motors expects a new hybrid-engine project to produce

Ford Motors expects a new? Hybrid-engine project to produce incremental cash flows of $ 95 million each year and expects these to grow at 4?% each year. The upfront project costs are? $900 million and? Ford's weighted av ...

A five-year bond with a yield of 11 continuously compounded

A five-year bond with a yield of 11% (continuously compounded) pays an 8% coupon at the end of each year. a) What is the bond's price? b) What is the bond's duration? c) Use the duration to calculate the effect on the bo ...

Image manufacturing is an electronics manufacturer and

IMAGE Manufacturing is an electronics manufacturer and retailer. Its main products are Ultrabook computers, PCs and calculators. The current price of the Ultrabook is $ 600, the PC is $700 and the calculator is $30. This ...

According to kulish what is about the design of the euro

According to Kulish, what is about the design of the euro currency that lessens its appeal compared to prior national currencies?

How has the value of the euro changed compared to other

How has the value of the Euro changed, compared to other countries, over the past 10 years (since the Great Recession began)?

In lecture we discussed why the production possibilities

In lecture we discussed why the production possibilities frontier (the boundary of the production possibilities set) is bowed 'outwards'. When might the production possibilities set be bowed 'inwards'? Give an example of ...

In 2013 gallup conducted a poll and found a 95 confidence

In 2013, Gallup conducted a poll and found a 95% confidence interval of the proportion of Americans who believe it is the government's responsibility for health care. Give the statistical interpretation. I do not underst ...

The standard deviation of the number of video game as

The standard deviation of the number of video game A's outcomes is 0.5479, while the standard deviation of the number of video game B's outcomes is 0.2498. Which game would you be likely to choose if you wanted players t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As