python画图八一五角星
时间: 2023-11-06 20:02:30 浏览: 202
用python画五角星
Python画图八一五角星的代码如下:
```python
import turtle
turtle.pensize(10)
turtle.begin_fill()
turtle.pencolor('red')
turtle.fillcolor('yellow')
turtle.up()
turtle.goto(-100, 0)
turtle.down()
for i in range(8):
if i % 2 == 0:
turtle.fd(200)
else:
turtle.fd(100)
turtle.right(45)
turtle.end_fill()
turtle.hideturtle()
```
阅读全文