Python列表帮助(查找最大数量)

Dim*_*tai 0 python string numbers list

好的,我写了这个脚本:

i=1024;
a=[0]*i;
for k in range(0,i):
    a[k]=(k*k*k*k-74*k*k+173) % 1000033
print a
Run Code Online (Sandbox Code Playgroud)

我不明白如何找到列表中的最大数字及其位置.

Fog*_*ird 6

这是一种方式:

value = max(a)
index = a.index(value)
Run Code Online (Sandbox Code Playgroud)

在您的示例中,值为999926,索引为2.