Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41139

Re: Finding the Min for positive and negative in python 3.3 list

Date 2013-03-12 18:45 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: Finding the Min for positive and negative in python 3.3 list
Newsgroups comp.lang.python
Message-ID <mailman.3241.1363110303.2939.python-list@python.org> (permalink)

Show all headers | View raw


----- 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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Finding the Min for positive and negative in python 3.3 list Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-03-12 18:45 +0100

csiph-web