def list_max(list):
    index = 0
    max = list[0]
    for i in range(1,len(list)):
        if (list[i]>max):
            max = list[i]
            index = i
    return (index,max)

list = [99, 11, 33, 111, 55, 66, 88]
res = list_max(list)
print("第%d个  最大值:%d"%res)


python求各行最大值 python如何求最大值_python求各行最大值

再讲一下

什么是递归

按照某一包含有限步数的法则或公式对一个或多个前面的元素进行运算,以确定一系列元素(如数或函数)的方法。

 


#递归
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
print(factorial(5))


python求各行最大值 python如何求最大值_python求各行最大值_02