小编use*_*288的帖子

Python for循环启动计数器初始化

for iteration in range(len(list) - 1):
  index = iteration +1 #This is the line which has no effect on the inner loop
  for index in range(len(list)):
    if list[iteration] > list[index]:
      newmin  = list[index]
      newminindex = index        
  if iteration != newminindex :
    swapnumbers(list,iteration, newminindex)
Run Code Online (Sandbox Code Playgroud)

以上是我为选择排序算法编写的代码片段.但是我看到内循环启动计数器总是从0开始.请求专家评论.

python loops for-loop

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

for-loop ×1

loops ×1

python ×1