[Edu-sig] about iterators, range, and summing consecutive integers
kirby urner
kirby.urner at gmail.com
Sat Mar 27 06:57:46 CET 2010
On Fri, Mar 26, 2010 at 10:38 PM, kirby urner <kirby.urner at gmail.com> wrote:
<< snip >>
> How else might we address a Python range object?
>
> With slicing notation:
>
>>>> d[1]
> 1
>>>> d[4]
> 4
>
Erratum: no, not with slicing notation, with individual indexes only:
>>> d[2:3]
Traceback (most recent call last):
File "<pyshell#230>", line 1, in <module>
d[2:3]
TypeError: sequence index must be integer, not 'slice'
>>>
Apologies.
Thanks for the pointer to an overview of turtle graphics responses Daniel.
I always thought Logo was under-appreciated for what it could do
completely independently of having a turtle. Your libraries prove that
you really appreciate Logo.
Speaking of turtle art, I found this entertaining session with Alex Martelli
helping out:
http://stackoverflow.com/questions/1452311/turtlegraphics-python-constraining-random-moving-turtle-in-a-circle
Note: The iterator stuff I just posted is to help with a 'Gnomon
Studies' lesson plan...
http://groups.yahoo.com/group/synergeo/message/58114
Kirby
More information about the Edu-sig
mailing list