Question: Describe the new file created by the program: def main(): countries = PlaceDataIntoList (UN.txt) countries.sort (key=bypop, revrse=True) createFile(countries) def placeDataIntoList(fileName): countries = [] infile =

Describe the new file created by the program: def main(): countries = PlaceDataIntoList ("UN.txt") countries.sort (key=bypop, revrse=True) createFile(countries) def placeDataIntoList(fileName): countries = [] infile = open (filename, 'x') for line in infile: line = line split(', ') if line[1] == "Europe": countries .append (list (line[0], eval (line[2])))) infile.close() return countries def bypop (country): return country[1] def createFile = (countries): outfile = open ("EuropeByPop.txt", 'w') for country in countries: outfile.write (country[0] + ', '+str(country[1]+" ") outfile close() main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
