1

The Koch Snowflake

We’ll start our Python adventures by figuring out how to draw an interesting shape called the Koch snowflake, invented by Swedish mathematician Helge von Koch in 1904. The Koch snowflake is a fractal—a type of figure that repeats itself as you zoom in to it.

Fractals derive their repeating nature from recursion, a technique where something is defined in terms of itself. In particular, you draw a fractal using a recursive algorithm, a repeating process where one repetition’s output becomes the input of the next repetition.

As you work through this chapter, you’ll learn:

  • • The basics of recursive algorithms and functions ...

Get Python Playground, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.