python画正方形的代码是什么? python画正方形的代码是: import turtle #导入turtle.title(画正方形)turtle.pensize(5) #画笔大小为5turtle.pencolor(red) #画笔颜色为红turtle.fillcolor(green) #填充颜色为绿t

python画正方形的代码是什么?
python画正方形的代码是:
import turtle #导入
turtle.title("画正方形")
turtle.pensize(5) #画笔大小为5
turtle.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画正方形的代码是什么?的详细内容,更多请关注自由互联其它相关文章!
