[Tutor] new

Tony Meyer tameyer at ihug.co.nz
Wed Mar 16 03:15:23 CET 2005


> Do you want a container with a range in it, like the list
> [1,2,3,4,5,...,100]:
> 
> >>> range(100)
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
[...]
> 92, 93, 94, 95, 96, 97, 98, 99]

Opps.  Notice that I did the range 0-99, of course.  But it's still the
function that you want.

[...]
> >>> sum(range(100))
> 4950

And again...

=Tony.Meyer



More information about the Tutor mailing list