求列表的最大值和最小值及其索引

c = [-10,-5,0,5,3,10,15,-20,25]

print c.index(min(c))  # 返回最小值
print c.index(max(c)) # 返回最大值
发布了234 篇原创文章 · 获赞 61 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/weixin_42528089/article/details/104901986