Turtle library in Python draws equilateral triangles

Turtle library in Python draws equilateral triangles

import turtle as t#Give the turtle library an nickname of t
for i in range(2):#Use a for loop to traverse
t.forward(50)
#Draw a line according to the front angle t.right(60)#The brush rotates to the right
t .backward(50)
#Draw a line according to the right rear angle t.right(60)#The brush rotates to the right
t.done()#Keep the window = turtle.done()
Because of the for loop, I am lazy to write the third line Up
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44948696/article/details/108458878