You can also draw the Sierpinski triangle by iteration or by the chaos method.
Chaos theory is an interdisciplinary scientific theory and branch of mathematics focused on underlying patterns and deterministic laws highly sensitive to initial conditions in dynamical systems that were thought to have completely random states of disorder and irregularities.
Since we use the method of drawing a game of chaos, we will need to repeat the same action hundreds and thousands of times. For automation, we will use a python program using the pygame multimedia library. I will not go into the details of python programming and using the pygame library because this article is not about that, but about fractals.
Let's continue talking about the Sierpinski triangle. In order to draw this triangle, first you need to put three random points on an arbitrary plane: