由于一至三题只存了源代码,自己写的没有保存,所以仅以截图展示。四至八题则采取代码和截图一起的方式展示。
2.4
import turtle
turtle.setup(650,360,800,200)
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(25)
turtle.seth(-40)
colors = ["blue","purple","pink","red","yellow","orange"]
for i in range(4):
turtle.pencolor(colors[i % len(colors)])
turtle.circle(40,80)
turtle.circle(-40,80)
turtle.pencolor(colors[i % len(colors)])
turtle.circle(40,80/2)
turtle.fd(40)
turtle.pencolor(colors[i % len(colors)])
turtle.circle(16,180)
turtle.fd(40 * 2/3)
2.5
import turtle
turtle.pensize(30)
turtle.pencolor("red")
turtle.fd(250)
turtle.seth(120)
turtle.fd(250)
turtle.seth(240)
turtle.fd(250)
turtle.pensize(10)
turtle.done
2.6
import turtle
turtle.pensize(10)
turtle.pencolor("blue")
turtle.fd(200)
turtle.seth(120)
turtle.fd(200)
turtle.seth(240)
turtle.fd(400)
turtle.seth(360)
turtle.fd(400)
turtle.seth(120)
turtle.fd(200)
turtle.seth(240)
turtle.fd(200)
turtle.seth(-240)
turtle.fd(200)
turtle.done
2.7
import turtle
turtle.pensize(10)
turtle.pencolor("pink")
turtle.seth(210)
turtle.fd(300)
turtle.seth(330)
turtle.fd(100)
turtle.seth(90)
turtle.fd(200)
turtle.seth(-30)
turtle.fd(300)
turtle.seth(210)
turtle.fd(300)
turtle.seth(90)
turtle.fd(100)
turtle.seth(-30)
turtle.fd(200)
turtle.seth(90)
turtle.fd(300)
turtle.done()
2.8
import turtle
t = turtle.Turtle()
length = 10
for i in range(50):
t.fd(length)
t.right(90)
t.fd(length)
t.right(90)
t.fd(length)
t.right(90)
t.fd(length + 1)
length += 5
turtle.done()