python get the maximum, minimum

1. Get an array of extreme value and returns the index

c = [ - 10 , - 5 , 0 , 5 , 3 , 10 , 15 , - 20 , 25 ]
 
print c.index( min (c)) # 返回最小值
print c.index( max (c)) # 返回最大值

Guess you like

Origin www.cnblogs.com/Sweepingmonk/p/11280844.html