看图编函数练习Python张大嘴巴的吃豆人?

0 Comments

看图编函数练习Python张大嘴巴的吃豆人

看图编函数练习Python张大嘴巴的吃豆人
一个小练习,不好取什么名字,要的拿去。以下是函数的代码:

def draw_arc(x,y,size):
    yanse = ['red','orange','yellow','green','cyan']
    penup()
    goto(x,y)
    setheading(0)
    right(90)
    pendown()
    for _ in range(2):
        color( yanse[_] )
        begin_fill()
        circle(size/2,90)
        end_fill()
        circle(size/2,-90)       
        circle(-size/2,90)
        begin_fill()
        circle(-size/2,-90)
        end_fill()        
        right(180)

发表评论