Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
Thursday, March 08, 2018
Allen Downey Ain't Perfect
He must not be aware of repl.it/languages/python_turtle -- makes life so simple. With that in mind, here's his draw() example :
import turtle
def draw(t, length, n):
if n == 0:
return
angle = 50
t.forward( length*n)
t.left(angle)
draw(t, length, n-1)
t.right( 2*angle)
draw(t, length, n-1)
t.left( angle)
t.back( length*n)
t = turtle.Turtle()
draw( t, 10, 6)
So cute, and an intro to fractals too :)
Labels:
allen downey,
python,
think python,
turtle
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment