【发布时间】:2014-09-05 01:45:59
【问题描述】:
我只学习 Python 1 周。这是我的代码:
def board():
colorA=input("Please choose a first color for the CheckerBoard: ")
colorB=input("Please choose a second color for the CheckerBoard: ")
size=int(input("Please choose a box size: "))
num=int(input("Please choose a side length for the board: "))
x=-250
y=250
c=colorA
x=-250
for num in range(num):
y=y-size
for num in range(num):
Fbox(x,y,size,c)
x=x+size
if(c==colorA):
c=colorB
elif(c!=colorA):
c=colorA
它几乎忽略了第一个“for”循环。
【问题讨论】:
-
为了理智,不要为不同的目的重复使用相同的变量。
-
对不起....我刚开始。
标签: python loops nested turtle-graphics