看图编程序练习之最胖十字架

0 Comments

下面这个图形不好取什么名字,先取这个名字吧,上课时把图形显示,让学生们去练习即可.
效果图最胖十字架

下面是参考程序:

import turtle

cs = ['red','orange','yellow','green']

turtle.shape('turtle')
turtle.bgcolor('black')
turtle.speed(0)
turtle.delay(0)

turtle.color('white')
turtle.penup()
turtle.begin_fill()
for i in range(4):
    turtle.fd(100)
    turtle.left(90)
turtle.end_fill()

for i in range(4):
    turtle.right(90)
    turtle.color(cs[i])
    turtle.begin_fill()
    turtle.circle(50,180)
    turtle.end_fill()

turtle.ht()

发表评论