Discuss / Python / 练习

练习

Topic source

暗影之_刃

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

from collections import Iterable

def findMaxAndMin(list): max = min = None if not isinstance(list,Iterable): return

for k,v in enumerate(list):
    if k==0:
        max = min = v
    else:
        if max<v:
            max=v
        if min>v:
            min=v
return (max,min)

  • 1

Reply