Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Programming questions