Norah Jones <nh.jones01 <at> gmail.com> writes:

> 
> For example:
> a=[-15,-30,-10,1,3,5]
> I want to find a negative and a positive minimum.
> example: negative
> print(min(a)) = -30
> positive
> print(min(a)) = 1
> 
> 
> 

try this:
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.






-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to