built in list generator?
Jerry Hill
malaclypse2 at gmail.com
Tue May 13 16:21:37 EDT 2008
On Tue, May 13, 2008 at 4:05 PM, globalrev <skanemupp at yahoo.se> wrote:
> if i want a list with all numbers between x and y is there a way to
> do this with an inbult function.
>
> i mean i can always construct a function to do this but is there
> soemthing like:
>
> nbrs = list(range(50,100, 2))
What's wrong with just using range()?
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(1, 10)
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(1, 11)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> range(1, 11, 2)
[1, 3, 5, 7, 9]
>>>
--
Jerry
More information about the Python-list
mailing list