Question
*PYTHON* Design and implement a class Country that stores the name of the country, its population, its area, and the population density (i.e., people per
*PYTHON* Design and implement a class Country that stores the name of the country, its population, its area, and the population density (i.e., people per square kilometer (or mile).. Then, write a program that reads data.txt and prints:
- The country with the largest area.
- The country with the largest population.
- The country with the largest population density
This quesiton requires TWO Python files. One is a Country class file and the other is the program that leverages the methods from the Country class and print the above three requests. You could leverage set()to store country information and do the operations.
In the data.txt, the attributes of each row refer to country, population, and area.
data.txt:
China 1,339,190,000 / 9,596,960.00
United States of America 309,975,000 / 9,629,091.00
Brazil 193,364,000 / 8,511,965.00
Japan 127,380,000 / 377,835.00
Canada 34,207,000 9,976,140.00
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