turtle库基础练习

1画一组同切圆

import turtle

turtle.circle(10)

turtle.circle(20)

turtle.circle(30)

2画一组同心圆

import turtle
turtle.circle(20)
turtle.up()
turtle.goto(0,-20)
turtle.down()
turtle.circle(40)
turtle.up()
turtle.goto(0,-40)
turtle.down()
turtle.circle(60)

 

3画一个五角星

import turtle

turtle.forward(100)

turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)

4画一个黄色实心五角星

import turtle
turtle.bgcolor('red')
turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.end_fill()

 

posted @ 2017-09-08 09:47  013洪辉  阅读(105)  评论(0编辑  收藏  举报