Short Python Code to say "Pick the lower value"?

Devoted picture Devoted · Jan 11, 2009 · Viewed 37.9k times · Source

What I mean is, I'm looking for really short code that returns the lower value. for example:

a=[1,2,3,4,5,6,7,8,9,10]
b=[1,2,3,4,5,6,7,8]
len(a) = 10
len(b) = 8
if (fill-this-in):
     print(lesser-value)

And I forgot to add that if b is lower than a, I want b returned - not len(b) - the variable b.

Answer

cschol picture cschol · Jan 11, 2009
print(min(a, b))