[Numpy-discussion] set operation

Benjamin Root ben.root@ou....
Tue Aug 17 09:30:54 CDT 2010

On Tue, Aug 17, 2010 at 9:11 AM, gerardob <gberbeglia@gmail.com> wrote:

> I would like to create a set composed of the numbers 2,3,4,...49,50,51. How
> do i do?
> Thanks.


Well, you can easily create a list of those numbers like so:

>>> a = range(2, 52)   # note, you have to go one past the last number you

Then, you can cast it as a set() object:

>>> b = set(a)

Does that help?
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100817/f90302a1/attachment-0001.html 

More information about the NumPy-Discussion mailing list