list1 = [100,200,300,500,10,30,45,432,900]
print list1
i = 1
lenlist = len(list1)
max = list1[0]
min = list1[0]
while(i <lenlist):
#print "tmp = %d list1[%d] = %d" % (tmp,i,list1[1])
if(max < list1[i]):
max = list1[i]
if(min > list1[i]):
min = list1[i]
i += 1
print "max value = %d " % max
print "min value = %d " % min
找出出列表的最大最小值
最新推荐文章于 2022-11-01 14:44:33 发布