turtle库绘图程序运行正常,代码行数超过30
行,有分支结构和循环结构,代码书写规范整洁,有注释。做出下图效果,90填充红色。
2条回答 默认 最新
- 溪风沐雪 2022-05-30 12:02关注
画了半天,看看是否可以
import math import turtle as t t.color('red') #t.tracer(10,1) t.begin_fill() t.right(130) for i in range(184): if i<175: t.fd(3) else: t.fd(30) t.right(2) t.left(138) t.fd(30) t.left(42) for i in range(185): if i<9: t.fd(30) t.left(2.5) else: t.fd(3.5) t.left(1.8) t.end_fill() t.penup() t.goto(280,-30) t.pendown() t.begin_fill() for i in range(500): radian = 2 * math.pi / 500 theta = (i+1)*radian next_point = (100*math.cos(theta)+180, 180*math.sin(theta)-20) t.setpos(next_point) t.goto(255,-30) t.end_fill() t.color('white') t.begin_fill() for i in range(500): radian = 2 * math.pi / 500 theta = (i+1)*radian next_point = (75*math.cos(theta)+180, 155*math.sin(theta)-20) t.setpos(next_point) t.end_fill() t.color('red') t.penup() t.goto(-120,60) t.pendown() t.write('北国',font=("宋体",35,"bold")) t.penup() t.goto(-120,10) t.pendown() t.write('药苑',font=("宋体",35,"bold")) t.penup() t.goto(160,60) t.pendown() t.write('红',font=("宋体",35,"bold")) t.penup() t.goto(160,0) t.pendown() t.write('色',font=("宋体",35,"bold")) t.penup() t.goto(160,-60) t.pendown() t.write('传',font=("宋体",35,"bold")) t.penup() t.goto(160,-120) t.pendown() t.write('承',font=("宋体",35,"bold")) #t.update() t.done()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用