1、Python的min函数返回列表中的最小的项。
2、如何返回列表中最小的项的索引?
def indexofMin(arr): minindex = 0 currentindex = 1 while currentindex < len(arr): if arr[currentindex] < arr[minindex]: minindex = currentindex currentindex += 1 return minindex arr = [3,5,2,1] print(indexofMin(arr))