How to know which is the largest and the smallest item in a list?