繪製奧運五環

 1 #五環
 2 import turtle     #引用turtle庫
 3 turtle.pensize(10)   #設置畫筆大小
 4 coordA=[-110,0,110,-55,55]    #各個圓X軸座標
 5 coordB=[-25,-25,-25,-75,-75]   #各個圓的Y座標
 6 colors=["red","blue","green","yellow","black"]
 7 for i in range(5):
 8     turtle.pencolor(colors[i])
 9     turtle.penup() 
10     turtle.goto(coordA[i],coordB[i])
11     turtle.pendown()
12     turtle.circle(45)
13 turtle.hideturtle()  #隱藏畫筆
五環

 

 啊~五環!你比六環少一環~ide

相關文章
相關標籤/搜索