码迷,mamicode.com
首页 > 其他好文 > 详细

9.12作业

时间:2017-09-12 16:18:05      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:range   9.png   作业   end   imp   import   es2017   src   forward   

a.五角星

import turtle
turtle.color(‘yellow‘)
turtle.bgcolor(‘red‘)
turtle.fillcolor(‘yellow‘)
def mytogo(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
mytogo(-300,100)
turtle.begin_fill()
for i in range(5):
turtle.forward(120)
turtle.right(144)
turtle.end_fill()

技术分享

b.同心圆

import turtle
for i in range(4):
turtle.up()
turtle.goto(0,-20*(i+1))
turtle.down()
turtle.circle(20*(i+1))

技术分享

 

c.太阳花

import turtle
turtle.color(‘yellow‘,‘red‘)
turtle.begin_fill()
while True:
turtle.forward(200)
turtle.left(175)
if(abs(turtle.pos()))<1:
break
turtle.end_fill()

技术分享

 

 

d.五个五角星

import turtle
turtle.color(‘yellow‘)
turtle.bgcolor(‘red‘)
turtle.fillcolor(‘yellow‘)
def mytogo(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
mytogo(-300,100)
turtle.begin_fill()
for i in range(5):
turtle.forward(120)
turtle.right(144)
turtle.end_fill()
mytogo(-200,200)
turtle.begin_fill()
for i in range(5):
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
mytogo(-140,120)
turtle.begin_fill()
for i in range(5):
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
mytogo(-140,40)
turtle.begin_fill()
for i in range(5):
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
mytogo(-200,-40)
turtle.begin_fill()
for i in range(5):
turtle.forward(50)
turtle.right(144)
turtle.end_fill()

技术分享

 

9.12作业

标签:range   9.png   作业   end   imp   import   es2017   src   forward   

原文地址:http://www.cnblogs.com/chenyanxi123/p/7509560.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!