import turtle
def square(length,n):#边长和边数
bob = turtle.Turtle()
for i in range(n):
bob.fd(length)
bob.lt(360/n)#每次所转角度
turtle.mainloop()
square(70,6)
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=14810f366fd210392f3943e7a1f03d90dabd650cb62dedfba80ceaa4476f2a40"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="pythonER" title="pythonER"></a>
原文:http://12181231.blog.51cto.com/12171231/1892731