资源简介 多彩几何学案认识Python打开Python的运行环境在界面中新建文件输入具体的代码保存文件运行代码文件显示运行结果导入turtle模块import turtle二、看一看、练一练1、画一个边长为50的圆形import turtleturtle.circle(50)turtle.done()画一个边长为50的红色正三角形import turtleturtle.color("red","red")turtle.begin_fill()turtle.circle(50,steps=3)turtle.end_fill()画一个边长为50的黄色正四边形import turtleturtle.color("yellow","yellow")turtle.begin_fill()turtle.circle(50,steps=4)turtle.end_fill()画一个边长为50的蓝色正五边形import turtleturtle.color("blue","blue")turtle.begin_fill()turtle.circle(50,steps=5)turtle.end_fill()画一个半径为50的绿色圆形import turtleturtle.color("green","green")turtle.begin_fill()turtle.circle(50)turtle.end_fill()函数调用及解释语句1、定位到坐标为(30,50)的位置def flyTo():turtle.penup()turtle.goto(30, 50)turtle.pendown()#调用该函数flyTo()2、画半径为50的蓝色圆def circle():turtle.color(“blue”,“blue”)turtle.begin_fill()turtle.circle(50)turtle.end_fill()#调用该函数circle()3、画边长为100的粉色正三角形def triangle():turtle.color(“pink”,“pink”)turtle.begin_fill()turtle.circle(100, 3)turtle.end_fill()#调用该函数triangle()4、画长为30宽为90的紫色长方形def rectangle():turtle.color(“purple”,“purple”)turtle.begin_fill()turtle.fd(30)turtle.left(90)turtle.forward(90)turtle.left(90)turtle.forward(30)turtle.left(90)turtle.forward(90)turtle.end_fill()#调用该函数rectangle()附: 展开更多...... 收起↑ 资源预览