Discuss / Python / 答案,供参考

答案,供参考

Topic source
# -*- coding: utf-8 -*-
def findMinAndMax(L):
    if len(L) == 0:
        return (None, None)
    max = L[0]
    min = L[0]
    for item in L:
        if item > max:
            max = item
        if item < min:
            min = item
    return (min,max)

  • 1

Reply