Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the program Thonny for the following Question: 1. United Nations The file UN. txt gives data about the 193 members of the United Nations.
Using the program Thonny for the following Question:
1. United Nations The file UN. txt gives data about the 193 members of the United Nations. Each line of the file contains four pieces of data about a country-name, con- tinent, population (in millions), and land area (in square miles). Some lines of the file are Canada, North America, 34.8,3855000 France, Europe, 66.3,211209 New Zealand, Australia/Oceania, 4.4,103738 Nigeria, Africa, 177.2.356669 Pakistan, Asia, 196.2,310403 Peru, South America, 30.1,496226 (a) Create a class named Nation with four instance variables to hold the data for a country and a method named pop Density that calculates the population density of the country. Write a program that uses the class to create a dictionary of 193 items, where each item of the dictionary has the form name of a country: Nation object for that country Use the file UN.txt to create the dictionary, and save the dictionary in a pickled binary file named nationsDict.dat. Also, save the class Nation in a file named nation.py
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