newbie seeks advise.

dwelch dwelch91 at nospam.attbi.com
Fri Sep 20 01:45:58 EDT 2002


akirasugiura wrote:
> Hi,
> 
> I've been learning python for about a month. I had no prior knowledge
> of programming.
> 
> My question is, I have a tuple which is, data = (69, 40, 74, 41, 56,
> 57, 38, 58, 26, 55). How I can make a function that picks up a largest
> number
>  from this "data" tuple. If "data" was a  'List' I would be able to
> use "sort" but since sort doesn't  work with tuple. I am stuck here.
> 
> Thanks in advance
> 
> Sincerely,
> 

Simple way, probably not optimal:

 >>> max_element = max(list(data))
 >>> max_element
74




More information about the Python-list mailing list