我不确定如何让它以正确的方式查看代码或图像 如果此代码执行以下操作
import turtle
turtle.penup()
for i in range(1, 500, 50):
turtle.right(90) # Face South
turtle.forward(i) # Move one radius
turtle.right(270) # Back to start heading
turtle.pendown() # Put the pen back down
turtle.circle(i) # Draw a circle
turtle.penup() # Pen up while we go home
turtle.home() # Head back to the start pos
如何更改代码以执行以下操作。我已尝试更改开始,正确等等。我希望它从我设置和缩小的设定半径开始,以便当它达到某个半径时它会停止what i want it to do
答案 0 :(得分:2)
每次都不回家,往下走两个半径。
import turtle
turtle.penup()
for i in range(1, 500, 10):
turtle.right(90) # Face South
turtle.forward(2 * i) # Move two radiuses down
turtle.right(270) # Back to start heading
turtle.pendown() # Put the pen back down
turtle.circle(i) # Draw a circle
turtle.penup() # Pen up while we go home