Discuss / Python / 交作业!

交作业!

Topic source

    def findMinAndMax(L):

        if isinstance(L,Iterable) is False:

            raise TypeError('L must be iterable!')

            if len(L) == 0:

                return (None,None)

            else: 

                minx=min(L)

                maxx=max(L)

                return (minx,maxx)

min和max是内置函数,我直接当成现成的用了


  • 1

Reply