How to get the index of max value?

Discussion created by SimonSt on Oct 9, 2012
Latest reply on Oct 10, 2012 by SimonSt

I'm using ArcMap 10 and started to work with Python some days ago. Now I'm having a problem which I can't solve on my own. I've got an Attribute Table including (among others) the fields BIOT1, BIOT2, BIOT3, BIOT4, BIOT5 which contain three letters (like MHZ) and PROZENT1, PROZENT2, PROZENT3, PROZENT4, PROZENT5 which contain a value between 1 and 100 or are empty. Now I want to find the max PROZENT value, check if it's greater than 60 and then return the corresponding BIOT value (e.g. BIOT3 for PROZENT3). If it's smaller then 60 I want to output "recheck".

What I already did is creating a new field an use the field calculator with this:

def Reclass(Biot1,Biot2,Biot3,Biot4,Biot5,Prozent1,Prozent2,Prozent3,Prozent4,Prozent5):
  Prozente = [Prozent1,Prozent2,Prozent3,Prozent4,Prozent5]
  maximum = max(Prozente)
  maxindex = Prozente.index(maximum) 
  if int(maximum) >= 60:
    return maxindex
    return "recheck"

At the moment I'm trying to return the Index of the max value but it always returns "0".
When I change from
return maxindex
return maximum
I get the correct maximum value. How can I get the correct index instead of "0"?

Thanks a lot,