Discuss / Python / 作业

作业

Topic source

容蟹屡

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

    if L==[]:

        return None, None

    else:

        max=L[0]

        min=L[0]

        for i in L:

            if max<=i:             #也可用while,但是不能用=号,否则会循环执行

                max=i

            if min>=i:

                min=i    

        return (min, max)  #return加不加(),貌似一样


  • 1

Reply