list1 = [-2,3,-5,7,8,9]
print( "最大值是%d,下标是%d" % (max(list1),list1.index(max(list1))) )
print( "最小值是%d,下标是%d" % (min(list1),list1.index(min(list1))) )
python寻找列表最大值最小值及其下标
最新推荐文章于 2023-03-23 16:35:01 发布
list1 = [-2,3,-5,7,8,9]
print( "最大值是%d,下标是%d" % (max(list1),list1.index(max(list1))) )
print( "最小值是%d,下标是%d" % (min(list1),list1.index(min(list1))) )