Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Selecting MAX from a list

0 views
Skip to first unread message

Ines T

unread,
Mar 5, 2010, 6:39:54 AM3/5/10
to pytho...@python.org
I need to select a maximum number from a list and then call the variable that
identifies that number, for example:
x1,x2=1, y1,y2=4, z1,z2=3
So I need first to find 4 and then to take y to do additional operations as y-z.
I will appreciate your SOON help!

lbolla

unread,
Mar 5, 2010, 7:24:51 AM3/5/10
to
On Mar 5, 11:39 am, Ines T <azt...@gmail.com> wrote:
> I need to select a maximum number from a list and then call the variable that
> identifies that number, for example:
> x1,x2=1, y1,y2=4, z1,z2=3
> So I need first to find 4 and then to take y to do additional operations as y-z.

It's not clear what you are supposed to do, but wouldn't a combination
of "max" and "index" do?
x = [3,2,1,4,5,2,3]
max(x) # 5
x.index(5) # 4

> I will appreciate your SOON help!

And, by the way, politeness is free!

0 new messages