奥运会五环python代码
时间: 2023-11-12 15:59:15 浏览: 116
python奥运五环在绘制代码
5星 · 资源好评率100%
以下是奥运会五环的 Python 代码:
```python
import turtle
# 设置画笔
pen = turtle.Turtle()
pen.width(10)
# 绘制蓝色圆环
pen.penup()
pen.goto(-110, -25)
pen.pendown()
pen.color("blue")
pen.circle(50)
# 绘制黄色圆环
pen.penup()
pen.goto(0, -25)
pen.pendown()
pen.color("yellow")
pen.circle(50)
# 绘制黑色圆环
pen.penup()
pen.goto(110, -25)
pen.pendown()
pen.color("black")
pen.circle(50)
# 绘制绿色圆环
pen.penup()
pen.goto(-55, -75)
pen.pendown()
pen.color("green")
pen.circle(50)
# 绘制红色圆环
pen.penup()
pen.goto(55, -75)
pen.pendown()
pen.color("red")
pen.circle(50)
# 隐藏画笔
pen.hideturtle()
# 等待用户关闭窗口
turtle.done()
```
阅读全文