[Tutor] Question about a python finction

peter peterrisley47 at gmail.com
Sat May 12 01:40:44 EDT 2018


range does not work the same for 2.7 and my 3.6.5. Seems they have 
changed the nature of range. It is a built in listed along with lists 
and tuples

>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

 >>> tuple(range(10))
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

seems they have changed range for python3.6.5 I do not know about the 
earlier python3 versions.  range(10) will not work with python3.6.5

check out https://docs.python.org/3.6/library/stdtypes.html#typesseq

On 05/11/2018 12:58 PM, David Rock wrote:
>> On May 9, 2018, at 07:14, kevin hulshof <kevinhulshof at live.nl> wrote:
>>
>> Hello,
>>
>> Is there a function that allows you to grab the numbers between two numbers?
>>
>> Eg. If you input the numbers 1 and 4
>> To make a list like this [1,2,3,4]
> One option is range
>
> range(1,5)
>
>>>> range(1,5)
> [1, 2, 3, 4]
>
> https://docs.python.org/2/library/functions.html#range
>
>> David Rock
> david at graniteweb.com
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list