max value in list

Peter Abel PeterAbel at gmx.net
Wed May 12 15:48:02 EDT 2004


"C GIllespie" <csgcsg39 at hotmail.com> wrote in message news:<c7te26$8q1$1 at ucsnew1.ncl.ac.uk>...
> Dear all,
> 
> I have a few lists. What's the best way of finding the maximum number of all
> the lists.
> 
> For example,
> 
> [2,3,4],[1,2,3],[4,7]
> 
> The max is 7.
> 
> Thanks
> 
> Colin

>>> l=[[2, 3, 4], [1, 2, 9], [4, 7]]
>>> max(map(max,l))
9
>>> l=[[2, 3, 4], [1, 2, 9],[12], [4, 7]]
>>> max(map(max,l))
12
>>> 

Regards
Peter



More information about the Python-list mailing list