python 海龟基础题
时间: 2023-10-12 15:13:22 浏览: 74
Python海龟绘图法详解
5星 · 资源好评率100%
好的,下面给你几道 Python 海龟基础题目:
1. 画一个正方形
```python
import turtle
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
```
2. 画一个五角星
```python
import turtle
turtle.right(72)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
```
3. 画一个螺旋线
```python
import turtle
for i in range(20):
turtle.forward(i * 10)
turtle.right(144)
```
阅读全文