标签:def port python imp turtle for pytho 多边形 rtl
import turtle
bob = turtle.Turtle()
#画四方形
def square(t,length):
for i in range(4):
t.lt(90)
t.fd(length)
square(bob,200)
#画多边形
def polygon(t,length,n):
for i in range(n):
t.lt(360/n)
t.fd(length)
polygon(bob,50,30)
#画圆形
def circle(t,r):
for i in range(1000):
t.lt(360 / 1000)
t.fd(3.14*2*r/1000)
circle(bob,100)
标签:def port python imp turtle for pytho 多边形 rtl
原文地址:http://www.cnblogs.com/xiaorourou/p/7729389.html