jython max function in an array -
a=[[10,1],[2,8]]
i need find max number in 2nd column of above array.
how in jython.
simply doing max(a)[1]
give 1.
thanks in advance.
-suresh
for jython 2.5 onwards ...
print max(a,key=lambda v:int(v[1]))[1]
otherwise you're stuck loop ...
m = none v in a: if m none or v[1] > m: m = v[1] print m
Comments
Post a Comment