Question: Write function list_sorting(lst1,lst2) which takes two lists: lst1 and lst2. Lst1 and lst2 are to contain the names of the employees and theirages respectively. Your
Write functionlist_sorting(lst1,lst2)which takes two lists: lst1 and lst2. Lst1 and lst2 are to contain the names of the employees and theirages respectively. Your function needs to return copies of these lists such that they are both sorted in order of age (descending order) (ie the names of employees in the lst1 are also required to be ordered according to their ages in lst2). If two or more employees have the same age then these employees need to be ordered by their names also (this time in ascending order: A-Z).
TestExpectedGotprint(list_sorting(['Chris','Amanda','Boris','Charlie'],[35,43,55,35])) (['Boris', 'Amanda', 'Charlie', 'Chris'], [55, 43, 35, 35]) print(list_sorting(['Tim','Mark','Ali','Cherry','Tina'],[45,65,33,37,45])) (['Mark', 'Tim', 'Tina', 'Cherry', 'Ali'], [65, 45, 45, 37, 33]) print(list_sorting(['George','Mark','Asad','Candy','Harry','Cira','Lee'],[35,41,35,65,41,23,41])) (['Candy', 'Harry', 'Lee', 'Mark', 'Asad', 'George', 'Cira'], [65, 41, 41, 41, 35, 35, 23]) print(list_sorting(['Ali','Aali','Asad','Amad','Arran','Allen','Abraham'],[41,41,41,65,41,23,41])) (['Amad', 'Aali', 'Abraham', 'Ali', 'Arran', 'Asad', 'Allen'], [65, 41, 41, 41, 41, 41, 23])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
