【发布时间】:2012-09-08 14:52:36
【问题描述】:
我正在尝试创建一个循环方块,但无法弄清楚如何让我的代码允许我继续重复创建方块的命令,乘以数字输入,这就是我目前所拥有的。
square_count = input("Enter the number of squares to draw: ")
count_int = int(square_ct)
if count_int > 1:
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
turtle.up()
turtle.forward(20)
turtle.color(random.random(),random.random(), random.random())
【问题讨论】:
标签: python loops for-loop turtle-graphics