条件循环函数定义 练习
Posted wtaure
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了条件循环函数定义 练习相关的知识,希望对你有一定的参考价值。
import turtle #五角星 turtle.color(\'yellow\') turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.right(144) turtle.end_fill()
import turtle #同心圆 def tongxinyuan(r): for i in range(5): turtle.penup() turtle.goto(0,-50*(i+1)) turtle.pendown() turtle.circle(r*(i+1)) tongxinyuan(50)
import turtle #太阳花 turtle.bgcolor(\'black\') turtle.color(\'gray\',\'white\') turtle.speed("fastest") turtle.begin_fill() while True: turtle.forward(250) turtle.left(155) if abs(turtle.pos())<1: break turtle.end_fill() turtle.done()
import turtle #五个五角星 turtle.bgcolor(\'red\') turtle.color(\'yellow\') #画一个五角星 def wujiaoxin1(x,y): turtle.begin_fill() for i in range(5): turtle.forward(x) turtle.right(y) turtle.end_fill() def wujiaoxin2(x,y): turtle.begin_fill() for i in range(5): turtle.forward(x) turtle.left(y) turtle.end_fill() #定义坐标 def zuobiao(x,y): turtle.up() turtle.goto(x,y) turtle.down() zuobiao(-330,190) wujiaoxin1(100,144) zuobiao(-190,250) wujiaoxin2(50,144) zuobiao(-150,170) wujiaoxin2(50,144) zuobiao(-150,110) wujiaoxin1(50,144) zuobiao(-190,20) wujiaoxin2(50,144)
import turtle turtle.bgcolor(\'black\') turtle.color(\'gray\',\'black\') turtle.speed("fastest") turtle.begin_fill() for i in range(73): turtle.forward(150) turtle.left(45) turtle.forward(150) turtle.left(135) turtle.forward(150) turtle.left(45) turtle.forward(150) turtle.left(135) turtle.left(5) turtle.end_fill()
以上是关于条件循环函数定义 练习的主要内容,如果未能解决你的问题,请参考以下文章