首页 > 其他 > 详细

条件、循环、函数定义 练习

时间:2017-09-12 12:51:00      阅读:239      评论:0      收藏:0      [点我收藏+]

1.

from turtle import*
shape(‘turtle‘)
color(‘yellow‘)
fillcolor(‘yellow‘)
begin_fill()
for i in range(5):
     forward(100)
     right(144)
end_fill()

技术分享

2.

from turtle import*
shape(‘turtle‘)
begin_fill()
for i in range(5):
     circle(30*(i+1))
     up()
     goto(0,-30*(i+1))
     down()

 技术分享

3.

from turtle import*
shape(‘turtle‘)

color(‘orange‘)
fillcolor(‘blue‘)
begin_fill()
while True:
      forward(200)
      left(200)
      if(abs(pos()))<1:
          break
end_fill()
done()

技术分享

4.

shape(‘turtle‘)

color(‘orange‘)
fillcolor(‘blue‘)
begin_fill()
while True:
forward(200)
left(200)
if(abs(pos()))<1:
break
end_fill()
done()


from turtle import*
bgcolor(‘red‘)
fillcolor(‘yellow‘)
color(‘yellow‘)
def wujiao(x,y):
up()
goto(x,y)
down()
wujiao(-300,230)
begin_fill()
for i in range(5):
forward(100)
right(144)
end_fill()
wujiao(-200,300)
begin_fill()
for i in range(5):
forward(50)
right(144)
end_fill()
wujiao(-150,250)
begin_fill()
for i in range(5):
forward(50)
right(144)
end_fill()
wujiao(-150,200)
begin_fill()
for i in range(5):
forward(50)
right(144)
end_fill()
wujiao(-200,150)
begin_fill()
for i in range(5):
forward(50)
right(144)
end_fill()

技术分享

 

条件、循环、函数定义 练习

原文:http://www.cnblogs.com/zheng01/p/7509238.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!