标签:imp code 字符 函数 循环 字符串操作 def raw log
1、用循环画五角星
from turtle import * while True: forward(200) right(144) if abs(pos()) < 1: break
2、用循环画同心圆
from turtle import * for i in range(5): pu() goto(0,-(i+1)*10) pd() circle((i+1)*10)
3、用while循环画太阳花
from turtle import * while True: forward(200) left(170) if abs(pos()) < 1: break done()
4、用函数定义画五个五角星
from turtle import * def a(x,y): pu() goto(x,y) pd() def b(): for i in range(5): forward(100) right(144) for i in range(5): a(-(i*100),0) b()
5、用函数定义画钻石花瓣的太阳花
from turtle import * def draw_lx(): for i in range(1,3): forward(100) right(45) forward(100) right(135) def draw_zuanshi(): speed(10) for i in range(36): draw_lx() right(10) draw_zuanshi()
标签:imp code 字符 函数 循环 字符串操作 def raw log
原文地址:http://www.cnblogs.com/zhenwei/p/7517524.html