Array/List: how to find in which column the minimum value is?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peachdot
    New Member
    • Aug 2010
    • 20

    Array/List: how to find in which column the minimum value is?

    hi,

    i used min() to find the minimum value of an array/list. it gives the min value of each row. But how do i know in which column does the min value is..?

    a=[[0 for i in range(3)]for j in range(4)]
    a[0]=[23,5,10]
    a[1]=[11,34,12]
    a[2]=[29,16,34]
    a[3]=[53,35,13]

    min(a[0])=5
    min(a[1])=11
    min(a[2])=16
    min(a[3])=13
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    Something like a[0].index(min(a[0]))

    Comment

    Working...