Discuss / Python / my task

my task

Topic source

郝宇臻

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

from collections import Iterable

def min_max(L): if not isinstance(L, Iterable): raise TypeError if len(L) == 0: return (None, None) else: a = L[0]
b = L[0] for i in L: if i <= a: a = i if i >= b: b = i return (a, b)


  • 1

Reply