Discuss / Python / 想了老久了……

想了老久了……

Topic source

xin-烁

#1 Created at ... [Delete] [Delete and Lock User]
def findMinAndMax(L):
 if len(L)==0:
  return(None,None)
 else:
  min=L[0]
  max=L[0]
  for x in L:
    if x<=min:
      min=x
    if x>=max:
      max=x
  return (min,max)

6


  • 1

Reply