17 – Loop-de-loop in Python

Anna Weltman and Dan Meyer are hosting a mathematical art contest based around loop-de-loops. We worked on paper first (CMONMATTTHINK), and then went to python. This was day one of python for the class, so it was a great intro without going too crazy in depth. The rules: you must keep the following setup, move(some distance), and left(90). Other than that they could change the number of times it looped, how many instructions were in the loop, etc. Here’s a code sample:

from turtle import *

multiplier = 30

speed(0)
for i in range(1,100):
    forward(3*multiplier)
    left(90)
    forward(1*multiplier)
    left(90)
    forward(4*multiplier)
    left(90)
    forward(2*multiplier)
    left(90)
    forward(7*multiplier)
    left(90)

Here are some of their marvelous creations:

IMG_1688 IMG_1687 IMG_1665 IMG_1664 IMG_1663 IMG_1662 IMG_1660 IMG_1659

 

 

dan

 

Leave a Reply

Your email address will not be published. Required fields are marked *