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: | Jul 2017 |
| Last Sign in: | 337 Weeks Ago, 6 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Hello, I am in an introductory Python class and need help finishing up my assignment. In class, we have learned how to use classes, objects, sets, dictionaries, loops, and other basic coding practices. I just need help creating the last few functions. below are the documents and .py files needed to understand the assignment. assignment4.py is were I am having trouble. Thanks
class CountryCatalogue:
def __init__(self, filename):
cDictionary = dict()
catalogue = []
country = []
file = open(filename)
content = file.readlines()
for line in content:
data = line.split(",")
catalogue.append(data[0])
cDictionary[data[0]] = data[1]
def filterCountriesByContinent(self):
def printCountryCatalogue(self):
def findCountry(self):
def deleteCountry(self):
def addCountry(self):
cName = input("Enter the country name: ")
population = float(input("Enter the population: "))
area = float(input("Enter the area: "))
continent = input("Enter the continent: ")
def setPopulationOfASelectedCountry(self):
def saveCountryCatalogue(self, filename):
def findCountryWithLargestPop(self):
pop = 9999999
for c in country:
if c.Population > pop:
pop = c.Population
return pop
def findCountryWithSmallestArea(self):
area = 0
for c in country:
if c.Area < area:
area = c.Area
return area
def findMostPopulousContinent(self):
def filterCountriesByPopDensity(self):
density = input("Enter the density: ")
for c in country:
if c.density == density:
print(c)
class Country :
def __init__(self, name, pop, area, continent) :
self.Name=name
self.Population =pop
self.Area =area
self.Continent =continent
self.density =0
def __repr__(self):
return self.Name +" in "+self.Continent
def setPopulation(self, pop):
self.Population =pop
def getName(self) :
return self.Name
def getArea(self) :
return self.Area
def getPopulation(self) :
return self.Population
def getContinent(self):
return self.Continent
def getPopDensity(self) :
return self.density
def save(self, outobject) :
outobject =self.Name +"|"+self.Continent+"|"+self.Population+"|"+self.density
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly