Search code examples
pythoncode-snippets

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


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.


Solution

  • print(min(a, b))