擅长:python、mysql、java
<p>你的乌龟一只一只地移动。第一个<code>while</code>循环使用<code>t1</code>执行任务,完成后,第二个<code>while</code>将处理<code>t2</code>。就像“<code>t1</code>,迈出第一步。然后,<code>t1</code>,做第二个。(重复这个过程直到<code>length1</code>不再小于500。)现在<code>t1</code>完成了,所以<code>t2</code>,迈出第一步。<code>t2</code>,你的第二步。(而且还在继续。)”</p>
<p>相反,你希望他们轮流走每一步。就像“<code>t1</code>,迈出第一步。然后,<code>t2</code>,做你的第一个。<code>t1</code>,迈出第二步。<code>t2</code>,轮到你迈出第二步了。(而且还在继续。)”</p>
<p>所以你的<code>while</code>循环应该是这样的:</p>
<pre class="lang-py prettyprint-override"><code>t1.pencolor(colors[length1 % 3])
t2.pencolor("pink")
while length1 < 500 or length2 < 500:
if length1 < 500:
t1.fd(length1)
t1.right(89)
length1 += 3 # length1 = length1 + 3
if length2 < 500:
t2.fd(length2)
t2.left(89)
length2 += 4 # length2 = length2 + 4
</code></pre>
<p>(注意,不必每次移动海龟时都设置铅笔颜色。)</p>