python中求列表元素的最大值和最小值
1、
>>> a = [34,28,187,22,128]
>>> max = a[0]
>>> for i in a: ## 求最大值
if i > max:
max = i
>>> print(max)
187
>>> min = a[0]
>>> for i in a: ## 求最小值
if i < min:
min = i
>>> print(min)
22