Dumb python questions
Paul Rubin
phr-n2001 at nightsong.com
Wed Aug 15 22:06:50 EDT 2001
Joal Heagney <s713221 at student.gu.edu.au> writes:
> Out of curiosity, is there a reason (e.g. curiosity on your part?)
> you're not using:
>
> N = 100
> sum = N*(N+1)/2
>
> which returns the sum of the first 100 integers much more quickly?
It was just a simple example to illustrate my question about how the
range function worked. Of course I wouldn't code it that way in real
life.
More information about the Python-list
mailing list