Discuss / Python / 经过测试,可以看看

经过测试,可以看看

Topic source

无虑43793

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

-- coding: utf-8 --

def findMinAndMax(L): if not L: return (None, None) for x,value in enumerate(L): if not isinstance(value, (int, float)): return (None, None) min=value for y,z in enumerate(L[x+1:]): if not isinstance(z, (int, float)): return (None, None) if z<min: L[x]=z L[x+y+1]=min min=z return (L[0],L[-1])


  • 1

Reply