Finding the Min for positive and negative in python 3.3 list

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Mar 12 13:45:01 EDT 2013


----- Original Message ----- 

> 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
> --
> http://mail.python.org/mailman/listinfo/python-list

min(a)

and

min([e for e in a if e >=0]

Cheers,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the Python-list mailing list