[Edu-sig] teaching python using turtle module

Brian Blais bblais at bryant.edu
Sun Nov 29 18:14:42 EST 2009


On Nov 29, 2009, at 17:51 , Edward Cherlin wrote:

> If you use the Python-programmable tile in Turtle Art in Sugar, or
> Smalltalk in the Turtle Graphics in Etoys, it's even better.

I'll have to check this out.

> sequences, where I can use a conditional to stop when the turtle would
> go off the screen.

ah, good idea.

>> or
>> functions that return values, as opposed to "procedures" like:
>> def square(length):
>>     forward(length)
>>     right(90)
>>     forward(length)
>>     right(90)
>>     forward(length)
>>     right(90)
>>     forward(length)
>>     right(90)
>
> Surely you mean
>
> repeat(4)
>    forward(length)
>    right(90)
>

surely I don't mean.  :)

that's not python.  I'd do:

def square(length):
     for i in range(4):
         forward(length)
         right(90)

but there isn't much difference with such a simple shape.  obviously,  
as one continued, the for-loop method would be clearer.



>> If-statements could possibly be used with some sort of random  
>> behavior (if
>> rand()<0.5 ...).
>
> Drunkard's Walk.
>

yes, that was the kind of thing I was thinking about.


	thanks!

		bb


-- 
Brian Blais
bblais at bryant.edu
http://web.bryant.edu/~bblais



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091129/24d20336/attachment-0001.html>


More information about the Python-list mailing list