To check if number is in range(x,y)

Dan Stromberg drsalists at gmail.com
Mon Dec 14 18:37:27 EST 2020


On Mon, Dec 14, 2020 at 3:07 PM Dan Stromberg <drsalists at gmail.com> wrote:

>
> On Mon, Dec 14, 2020 at 1:23 PM Schachner, Joseph <
> Joseph.Schachner at teledyne.com> wrote:
>
>> >>> r = range(10)
>> So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
>>
> To get a list of consecutive int's, you can use, for EG:
> r = list(range(10))
>

Oh, and range() returning a (lazy) range is a new thing.  In Python 2.x,
range returned a list and you had to use xrange to get laziness.


More information about the Python-list mailing list