本文摘自php中文网,作者coldplay.xixi,侵删。

python画正方形的代码是什么?
python画正方形的代码是:
1 2 3 4 5 6 7 8 9 10 11 | 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画正方形的代码是什么?的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python阶乘求和的方法
Python如何输出平均成绩
如何获取一个文件的创建和修改时间
Python的选择语句是什么语句
Python变量名有哪些
Python中可迭代对象分解为单独的变量的实现方法(代码)
Python函数有哪些?
Python list有序吗
Python质数如何判断
比较import reload __import__在Python中的用法区别
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python画正方形的代码是什么?