Is there any pythonic way to find out a variable is having a minimum value out of a bunch of variables. for example
In [5]: if d<c and d<b and d<a:
...: print "d is minimum.."
...:
d is minimum..
Now here only 3 variables are there, So we can do it using and, but what if there are so many variables there to compare ?
please tell me the case of checking at once d is maximum or not with all other variables.?
What about checking d is equal to all other variables ?
My solution:
May be we can add all the variable which needs to be compare in a list
and compare them One by one, but I think there must be a better way to
do this using python.
Using
allwhich will be efficient as it will short-circuit:Where
ican be any iterableYour example would be: