Discuss / Python / 作业

作业

Topic source

test_number

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

借鉴了一下你们的

-- coding: utf-8 --

from collections import Iterable

def findMinAndMax(L): L=input('请输入迭代数据-->') if len(L)==0: return None if not isinstance(L,Iterable): raise TypeError('您输入的是非可迭代数据') min=L[0] max=L[0] for i,val in enumerate(L): if val<min: min=val if val>max: max=val return min,max

L=[] print(findMinAndMax(L))


  • 1

Reply