Interview Query

5th Largest Number

2
Have you seen this question before?

You’re given numlists, a list where each element is a list of at least five numbers.

Write a function list_fifths that returns a list of the fifth-largest number from each element in numlists. Return the list in ascending order.

Example:

Input:

numlists = [ [1,2,3,4,5], [3,1,2,5,4], [1,2,3,4,5,6,7], 
[99, 320, 400, 100.25, 55.2, 0.1] ]

Output:

def list_fifths(numlists) -> [1, 1, 3, 55.2]
Next question: Changing Composer
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code