turtle库基础练习
1.画一组同切圆
>>> import turtle >>> turtle.circle(10) >>> turtle.circle(20) >>> turtle.circle(30) >>> turtle.circle(40) >>> turtle.circle(50)
![](https://images2017.cnblogs.com/blog/1232595/201709/1232595-20170912112059500-1571010753.png)
2.画一组同心圆
turtle.up()
turtle.goto(50,50)
turtle.down()
turtle.circle(10)
turtle.up()
turtle.goto(50,30)
turtle.down()
turtle.circle(30)
turtle.up()
turtle.goto(50,10)
turtle.down()
turtle.circle(50)
![](https://images2017.cnblogs.com/blog/1232595/201709/1232595-20170912194837844-1756393777.png)
3.画一个五角星
turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144)
turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144)
![](https://images2017.cnblogs.com/blog/1232595/201709/1232595-20170912112955297-53310159.png)
4.画一个黄色实心五角星
turtle.shape("turtle") turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.end_fill() turtle.hideturtle()
5.画左上角的五颗五角星
import turtle turtle.shape("turtle") turtle.bgcolor("red") turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.up() turtle.goto(-200,200) turtle.forward(75) turtle.right(144) turtle.forward(75) turtle.right(144) turtle.forward(75) turtle.right(144) turtle.forward(75) turtle.right(144) turtle.forward(75) turtle.right(144) turtle.end_fill() turtle.hideturtle() turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.up() turtle.goto(-110,270) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.end_fill() turtle.hideturtle() turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.up() turtle.goto(-70,220) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.end_fill() turtle.hideturtle() turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.up() turtle.goto(-85,165) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.end_fill() turtle.hideturtle() turtle.fillcolor('yellow') turtle.color("yellow") turtle.begin_fill() turtle.up() turtle.goto(-130,120) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.forward(45) turtle.right(144) turtle.end_fill() turtle.hideturtle()
turtle.done()