max value in list

Jean Brouwers mrjean1 at earthlink.net
Wed May 12 11:28:46 EDT 2004


[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]


What about:

m = max([max(i) for i in (list1, list2, list3, etc...)])

Example:

>>> max([max(i) for i in ([2,3,4], [1,2,3], [4,7])])
7

/Jean Brouwers
 ProphICy Semiconductor, Inc.


In article <c7te26$8q1$1 at ucsnew1.ncl.ac.uk>, C GIllespie
<csgcsg39 at hotmail.com> wrote:

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



More information about the Python-list mailing list