Fractal snowflake

I’m taking a Python class at the local Adult Ed. They just had us code a fractal snowflake to teach us recursion. It’s kinda fun, I suppose.

My code is below:

import turtle
def koch(t, length, n):
    if n == 0:
    angle = 60
    koch(t, length, n-1)
    koch(t, length, n-1)

def snowflake(t,length,n):
    for i in range(6):
        koch(t, length,n)
myrtel = turtle.Turtle()

snowflake(myrtel, 3, 5)

2 thoughts on “Fractal snowflake

  1. Russ Post author

    Yes, that must have gotten dropped when I copied it to the blog. I’ve added it so that others can copy the code.
    Thanks for catching it.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.