代码示例
board = []
for i in range(5):
board.append(i)
print board board = []
i = 0
while i < 5:
board.append(i)
i = i + 1
print board
两组的循环的结果相同
[0]
[0, 1]
[0, 1, 2]
[0, 1, 2, 3]
[0, 1, 2, 3, 4]
2024-02-07 17:22:05
代码示例
board = []
for i in range(5):
board.append(i)
print board board = []
i = 0
while i < 5:
board.append(i)
i = i + 1
print board
两组的循环的结果相同
[0]
[0, 1]
[0, 1, 2]
[0, 1, 2, 3]
[0, 1, 2, 3, 4]