for i in range(开始/左边界, 结束/右边界, 步长): print i
例如
for i in range(1, 10, 2): print i
等价于
for (i=1;i<=10;i+=2)
结果
1 3 5 7 9 [Finished in 0.4s]
时间: 2024-11-05 13:31:13
for i in range(开始/左边界, 结束/右边界, 步长): print i
例如
for i in range(1, 10, 2): print i
等价于
for (i=1;i<=10;i+=2)
结果
1 3 5 7 9 [Finished in 0.4s]