Draw sierpinski triangle using turtle in python. If one tries to draw the biggest triangle first, he/she will find the method has very bad extensibility since there will be too many position. The first version (it’s not good at all and I know it):
1 | import turtle |
Graph:
Actually there is a traditional way to draw recursion shape like this. See koch fractals. Inspired by this, a good version of Sierpinski triangle should look like this:
1 | import turtle |
Graph: