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开始.请求专家评论.