Interview Query

5th Largest Number

Start Timer

0:00:00

Upvote
2
Downvote
Save question
Mark as completed
View comments (18)
Next question

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]
.
.
.
.
.


Comments

Loading comments