Question: Python Turtle Code:: Triangle with color Drawing a Sierpinski triangle using GUI/Turtle. Write a program that draws Sierpinski triangle using recursive methods as shown below:

Python Turtle Code:: Triangle with color

Drawing a Sierpinski triangle using GUI/Turtle.

Write a program that draws Sierpinski triangle using recursive methods as shown below:

Python Turtle Code:: Triangle with color Drawing a Sierpinski triangle using GUI/Turtle.

Hints:

The three points of the triangle are passed to invoke displayTriangles. If order == 0, the displayTriangles (order, p1, p2, p3) function displays a triangle that connects three points p1, p2, and p3, as shown in Figure a. Otherwise, it performs the following tasks:

1. Obtains a midpoint between p1 and p2), a midpoint between p2 and p3, and a midpoint between p3 and p1, as shown in Figure b.

2. Recursively invokes displayTriangles with a reduced order to display three smaller Sierpinski triangles. Note that each small Sierpinski triangle is structurally identical to the original big Sierpinski triangle except that the order of a small

triangle is one less, as shown in Figure b.

Write a program that draws Sierpinski triangle using recursive methods as shown

Drawing a Sierpinski triangle spawns calls to draw three small Sierpinski triangles recursively.

Once done, rewrite the programs for filled Sierpinski triangles.

Sierpinski Triangle ATA Enter an order: Display Sierpinski Triangle

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!