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)
以上是我为选择排序算法编写的代码片段。但是我看到内部循环开始计数器总是从 0 开始。请求专家评论。