编程实现对一个元素全为数字的列表,求最大值、最小值(回炉笔记)

__author__ = 'zht'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
#努力学习每一天
'''
import operator

#方法1
a = [1,2,3,4,5,6,7,11,10,9,]
i = 1
b = a[0]

while i <= len(a):
    for k in a:
        if b >= k:
            pass
        else:
            b = k
    i +=1
print(b)

#方法2
res = max(a)
print(res)
res = min(a)
print(res)

  

转载于:https://www.cnblogs.com/zhaohongtaodepython/p/9351814.html

你可能感兴趣的:(编程实现对一个元素全为数字的列表,求最大值、最小值(回炉笔记))