WAP in python to accept a list of numbers only maximum length 10.

1.program it to maintain list of 10 values only
2.only largest 10 values should remain
3.when user gives new input,list will only be modified if the new input is larger than the smallest in the list.

The easiest and efficient way will be to use python heapq module to create explicitly making sure the size doesn’t exceed 10 and insertion/removal if greater than minimum element.

1 Like

Anyone have solution to this one?

I am just a beginner.Can anyone solve it.