题目:绘制下面的图形

python turtle 100-4
Python 海龟绘图 100 题——第 4 题

解析:

考察 turtle 绘制正方形。每次转过的角度都是 90 度。

答案:

不使用循环。
Python
import turtle as t
t.fd(100)
t.rt(90)
t.fd(100)
t.rt(90)
t.fd(100)
t.rt(90)
t.fd(100)
t.rt(90)
使用循环。
Python
import turtle as t
for i in range(0,4):
    t.fd(100)
    t.rt(90)