如何在 python 上制作复杂的海龟图?

how to make a complex turtle diagram on python?

我想使用 turtle python 制作一个复杂的图表 python 有人可以帮我吗我什至不知道从哪里开始。 我试过了,但因为我是 python 的新手,我不知道任何关键术语及其含义:(

这是什么意思?:

import turtle

试试这个:

import turtle

ninja = turtle.Turtle()

ninja.speed(10)

for i in range(180):
    ninja.forward(100)
    ninja.right(30)
    ninja.forward(20)
    ninja.left(60)
    ninja.forward(50)
    ninja.right(30)

    ninja.penup()
    ninja.setposition(0, 0)
    ninja.pendown()

    ninja.right(2)

turtle.done()

我的意思是这很酷,我知道你不知道从哪里开始,但至少 post 一些先验知识,以便其他用户可以给你建议来发展你的技能

回答您的具体问题:

what does this mean?:

import turtle

import 命令用于将额外的代码集合带入 Python 供您使用。 turtle 库就是这样的一个例子——Python 不会响应 turtle 命令,直到你通过这个 import 语句将它们带入 Python。

有在线documentation for Turtle。为了快速查找,您可以通过以下方式检查您加载的内容:

>>> import turtle
>>> dir(turtle)

并通过以下方式查找各个函数:

>>> help(turtle.forward)

来自互动 Python shell.