Discuss / Python / 一开始连判断大小都不会了

一开始连判断大小都不会了

Topic source

飞页快刀

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

def maxmin(*L):

    if not L:

        return "不能为空"

    else:

        Max=Min=L[0]

        for i in L:

            if  not isinstance(i,(int,float)):

                    return ("需要数字")

            else:

                if i > Max:

                    Max = i

                if i < Min:

                    Min = i

    return (Max,Min)

我复制这个上去为什么会测试失败啊

晓得了,应该return(None,None),还有return(Min,Max)


  • 1

Reply