python画正方形的代码是什么?
python画正方形的代码是:
import turtle #导入turtle.title("画正方形")turtle.pensize(5) #画笔大小为5turtle.pencolor("red") #画笔颜色为红turtle.fillcolor("green") #填充颜色为绿turtle.begin_fill() #开始填充for i in range(4): #循环四次 turtle.forward(200) #前进200 turtle.left(90) #左转90度turtle.end_fill() #结束填充turtle.done() #导入结束
推荐教程:《python视频教程》
以上就是python画正方形的代码是什么?的详细内容。