Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python data structure Task 4: Emirates A data set of emperors along with their years they died have been given in a text file attached

image text in transcribed

python data structure

Task 4: Emirates A data set of emperors along with their years they died have been given in a text file attached with this document. Write a function SortEmpire() that takes list of objects of empire. The object consists of empire name and the year. The function should return a python list of containing objects in chronological order. The complete task should be executed in O(n). File Format Each line of the file contains two values N and Y separated by comma. Nis the name of the emperors and Y is the year they died. Sample File: Tsiimba Mukuumbi, 1894 Cyrus the Great, 530 Bardiya, 522 Xerxes I, 486 Bivula Bangi, 1929 def SortEmpire (file): // your code goes here Example: print (SortEmpire ("emperors.txt")) #the function should return Xerxes I, 486 Bardiya, 522 Cyrus the Great, 530 Tsiimba Mukuumbi, 1894 Bivula Bangi, 1929

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions