""" koch.py Using python's built in turtle to draw a Koch curve fractal. See https://en.wikipedia.org/wiki/Koch_snowflake . Jim Mahoney | cs.bennington.college | Oct 2020 | MIT License """ import turtle def koch(length=400, recursionDepth=4): """ Recursively draw a Koch curve. """ if recursionDepth == 0: turtle.forward(length) else: for angle in (0, 60, -120, 60): turtle.right(angle) koch(length/3.0, recursionDepth - 1) def main(): koch(380) # length in pixels input('Hit return to quit.') main()