python 绘制奥运五环
一、预期结果
二、核心代码
import turtle
print("开始绘制奥运五环")
# 创建Turtle对象
pen = turtle.Turtle()
pen.shape("turtle")
pen.pensize(8)
print("绘制蓝色圆")
pen.up()
pen.goto(50-170,0)
pen.down()
pen.color('blue')
pen.circle(50)
print("绘制黑色圆")
pen.up()
pen.goto(170-170,0)
pen.down()
pen.color('black')
pen.circle(50)
print("绘制红色圆")
pen.up()
pen.goto(290-170,0)
pen.down()
pen.color('red')
pen.circle(50)
print("绘制黄色圆")
pen.up()
pen.goto(110-170,-60)
pen.down()
pen.color('yellow')
pen.circle(50)
print("绘制绿色圆")
pen.up()
pen.goto(230-170,-60)
pen.down()
pen.color('green')
pen.circle(50)
print("绘制完成")
# 隐藏画笔
pen.hideturtle()
turtle.done()