Discuss / Python / 作业

作业

Topic source

仙羽_幻境

#1 Created at ... [Delete] [Delete and Lock User]
if L == []: 
  return (None, None)

min=max=L[0]
for x in L:
  if max<x:
    max=x
  if min>x:
    min=x
return (min, max)

仙羽_幻境

#2 Created at ... [Delete] [Delete and Lock User]
if L == []: 
    return (None, None)

min=max=L[0]
for x in L:
   max = x if max<x else max
   min = x if min>x else min
return (min, max)

  • 1

Reply