条件循环函数定义 练习
Posted 会搓火球的单身gou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了条件循环函数定义 练习相关的知识,希望对你有一定的参考价值。
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()
以上是关于条件循环函数定义 练习的主要内容,如果未能解决你的问题,请参考以下文章