程序代码:
import turtle as t
for i in range(3):
t.seth(i*120)
t.fd(200)
程序代码:
import turtle as t
t.seth(30)
for i in range(2):
t.fd(200)
t.right(60 if i==0 else 120)
for i in range(2):
t.fd(200)
t.right(60 if i==0 else 120)
程序代码:
import turtle
d=0
for i in range(4):
turtle.fd(200)
d=d+90
turtle.seth(d)
程序代码:
import turtle as t
for i in range(4):
t.seth((i+1)*90)
t.circle(200,90)
t.seth((i+3)*90)
t.circle(200,90)
程序代码:
import turtle
d=0
for i in range(4):
turtle.right(90)
turtle.circle(100,180)
程序代码:
import turtle
for i in range(4):
turtle.circle(-100,90)
turtle.right(180)
程序代码:
import turtle
r=10
head=90
for i in range(4):
turtle.seth(head)
turtle.circle(r)
r=r+40
turtle.done()
程序代码:
import turtle
r=10
dr=40
head=90
for i in range(4):
turtle.pendown()
turtle.circle(r)
r+=dr
turtle.penup()
turtle.seth(-90)
turtle.fd(dr)
turtle.seth(0)
turtle.done()
程序代码:
import turtle
turtle.pensize(3)
d=0
k=5
for j in range(10):
for i in range(4):
turtle.fd(k)
d+=(90+1)
turtle.seth(d)
k+=5
turtle.done()
程序代码:
import turtle
def drawCircle():
turtle.pendown()
turtle.circle(20)
turtle.penup()
turtle.fd(40)
def drawRowCircle(n):
for j in range(1,n+1):
for i in range(j):
drawCircle()
turtle.fd(-j*40-60)
turtle.seth(90)
turtle.fd(40)
turtle.seth(0)
turtle.fd(40)
drawRowCircle(5)
turtle.hideturtle()
turtle.done()
程序代码:
import turtle
edge=6
d=0
k=1
for j in range(10):
for i in range(6):
turtle.fd(k)
d+=60
turtle.seth(d)
k+=3
turtle.done()
程序代码:
import turtle as t
def FlowerPainting(FlowerList):
# FlowerList表示一个花瓣的个数的列表
R=50
Pos=0
t.pencolor("red")
for flower in FlowerList:
angle=360/flower
r=50*(90/angle)
for i in range(flower):
t.seth(i*angle)
t.circle(r,angle)
t.penup()
t.goto(Pos,0)
t.pendown()
t.seth(i*angle+angle)
t.circle(-r,angle)
t.penup()
t.goto(Pos,0)
t.pendown()
t.penup()
Pos+=150
t.goto(Pos,0)
t.pendown()
FlowerPainting([8,10,20])
程序代码:
import turtle as t
import math
def MultiTriangle(CountList):
# CountList表示每个多边形包含多少个三角形的列表
R=50
Pos=0
t.pencolor("blue")
for Count in CountList:
angle=360/Count
for i in range(Count):
t.seth(i*angle+angle/2)
t.fd(R)
t.seth(90+angle*(i+1))
length=math.sin(angle/2*math.pi/180)*R*2
t.fd(length)
t.penup()
t.goto(Pos,0)
t.pendown()
t.penup()
Pos+=120
t.goto(Pos,0)
t.pendown()
MultiTriangle([5,6,7,8])