Finding the Min for positive and negative in python 3.3 list
wolfgang.maier at biologie.uni-freiburg.de
Tue Mar 12 18:48:34 CET 2013
Norah Jones <nh.jones01 <at> gmail.com> writes:
> For example:
> I want to find a negative and a positive minimum.
> example: negative
> print(min(a)) = -30
> print(min(a)) = 1
min(a) => -30
min([n for n in a if i>0]) => 1
of course, you have to figure out what you want to do with a zero value.
More information about the Python-list