import turtle

def circle(x,y,r):

x1=x

y1=y-r

jump(x1, y1)

turtle.circle(r)

def sin(degree):

import math

radians = degree * math.pi / 180

return math.sin(radians)

def cos(degree):

import math

radians = degree * math.pi / 180

return math.cos(radians)

def star(x,y,length):

turtle.begin_fill()

jump(x,y)

i = 0

while i < 5:

forward(length)

right(144)

i = i + 1

def center_star(x, y, r):

jump(x,y)

angel=18

x1 = x - cos(angel)*r

y1 = y + sin(angel)*r

length = cos(angel) * r * 2

star(x1,y1,length)

turtle.color('red')

turtle.begin_fill()

circle(0,0,400/2)

turtle.end_fill()

turtle.color('white')

turtle.begin_fill()

circle(0,0,340/2)

turtle.end_fill()

turtle.color('red')

turtle.begin_fill()

circle(0,0,280/2)

turtle.end_fill()

turtle.color('blue')

turtle.begin_fill()

circle(0,0,240/2)

turtle.end_fill()

turtle.color('white')

turtle.begin_fill()

center_star(0,0,120)

turtle.end_fill()

5 条评论

  • @ 2023-3-11 16:23:44

    老师讲过了,这个讨论不合格

    • @ 2023-3-11 13:42:38

      老师上课源代码讲解,为什么还要发帖子?

      • @ 2023-3-11 13:44:43
        import turtle
        def sin(degree):
            import math
            radians = degree * math.pi / 180
            return math.sin(radians)
        def cos(degree):
            import math
            radians = degree * math.pi / 180
            return math.cos(radians)
        def star(x,y,length):
            turtle.penup()
            turtle.goto(x,y)
            turtle.pendown()
            turtle.begin_fill()
            angle = 144
            i = 0
            while i < 5:
                turtle.forward(length)
                turtle.right(angle)
                i = i + 1
            turtle.end_fill()
        def center_star(x,y,r):
            turtle.penup()
            turtle.goto(x,y)
            turtle.pendown()
            angle = 18
            x1 = x - cos(angle) * r
            y1 = y + sin(angle) * r
            length = cos(angle) * r * 2
            star(x1,y1,length)
        def circle(x, y, r):
            turtle.penup()
            turtle.goto(x, y)
            turtle.pendown()
            y1 = y - r
            x1 = x
            turtle.penup()
            turtle.goto(x1, y1)
            turtle.pendown()
            turtle.circle(r)
        turtle.color('red')
        turtle.begin_fill()
        circle(0,0,400/2)
        turtle.end_fill()
        turtle.color('white')
        turtle.begin_fill()
        circle(0,0,340/2)
        turtle.end_fill()
        turtle.color('red')
        turtle.begin_fill()
        circle(0,0,280/2)
        turtle.end_fill()
        turtle.color('blue')
        turtle.begin_fill()
        circle(0,0,240 / 2)
        turtle.end_fill()
        turtle.color('white')
        center_star(0,0,240/2)
        
    • @ 2023-3-10 20:54:16

      对于一级水平来说是有些难,好好一下消化吧

      • @ 2023-3-10 13:30:09

        我真怕你看不懂

        import turtle
        def sin(degree):
            import math
            radians = degree * math.pi / 180
            return math.sin(radians)
        def cos(degree):
            import math
            radians = degree * math.pi / 180
            return math.cos(radians)
        def star(x,y,length):
            turtle.penup()
            turtle.goto(x,y)
            turtle.pendown()
            turtle.begin_fill()
            angle = 144
            i = 0
            while i < 5:
                turtle.forward(length)
                turtle.right(angle)
                i = i + 1
            turtle.end_fill()
        def center_star(x,y,r):
            turtle.penup()
            turtle.goto(x,y)
            turtle.pendown()
            angle = 18
            x1 = x - cos(angle) * r
            y1 = y + sin(angle) * r
            length = cos(angle) * r * 2
            star(x1,y1,length)
        def circle(x, y, r):
            turtle.penup()
            turtle.goto(x, y)
            turtle.pendown()
            y1 = y - r
            x1 = x
            turtle.penup()
            turtle.goto(x1, y1)
            turtle.pendown()
            turtle.circle(r)
        turtle.color('red')
        turtle.begin_fill()
        circle(0,0,400/2)
        turtle.end_fill()
        turtle.color('white')
        turtle.begin_fill()
        circle(0,0,340/2)
        turtle.end_fill()
        turtle.color('red')
        turtle.begin_fill()
        circle(0,0,280/2)
        turtle.end_fill()
        turtle.color('blue')
        turtle.begin_fill()
        circle(0,0,240 / 2)
        turtle.end_fill()
        turtle.color('white')
        center_star(0,0,240/2)
        
        • 这个·····应该很少人会吧?(如果能解答的话当我没说)

        • 1

        信息

        ID
        66
        时间
        1000ms
        内存
        256MiB
        难度
        7
        标签
        递交数
        1120
        已通过
        249
        上传者