Discuss / Python / 这个作业为什么测试失败?

这个作业为什么测试失败?

Topic source

    if L!=[]:

        max = L[0]

        min = L[0]

        for n in L:

            if n > max:

                max = n

            if n < min:

                min = n

        return (max, min)

    else:

        return (None, None)

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

你注意看测试代码:

findMinAndMax([7, 1, 3, 9, 5]) ----> (1, 9)

谢谢老师 ,懂了


  • 1

Reply