from collections.abc import Iterable
def findMinAndMax(L):
if isinstance(L, Iterable) and L:
mix = L[0]
max = L[0]
for value in L:
if mix >= value:
mix = value
if max <= value:
max = value
return (mix, max)
else:
return (None, None)
Sign in to make a reply
今
from collections.abc import Iterable
def findMinAndMax(L):
if isinstance(L, Iterable) and L:
mix = L[0]
max = L[0]
for value in L:
if mix >= value:
mix = value
if max <= value:
max = value
return (mix, max)
else:
return (None, None)