擅长:python、mysql、java
<p>只有在定义两个列表时,才能执行这些方法。像这样更改代码的相关部分</p>
<pre><code>moves=[pen.forward, pen.backward]
turns=[pen.right, pen.left]
while True:
pen.color(random.randint(0,255), random.randint(0,255), random.randint(0,255))
random.choice(turns)(90)
random.choice(moves)(30)
</code></pre>