我正在尝试创建一个循环,该循环接受用户的输入并绘制许多正方形,但它会增加每个循环的正方形的大小,但是两个边保持连接。我将包含图形以更好地解释。
import turtle
squares = 1
while squares >= 1:
squares = int(input('How many squares would you like drawn?:'))
if squares == 0:
print("You must have at-least 1 square.")
squares = int(input('How many squares would you like drawn?:'))
else:
for count in range(squares):
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
turtle.left(90)
turtle.done()