j mercedes wrote:
Hi, I have problem here...I am writing a program but I am getting stucked at how to solve the mode of a series of numbers...any ideas???following is the program:

def mode(data):
    num=0
    count=0
    mx=0
    mode=0
    for i in data:

i here takes on the values of data -- it isn't the index

        if num!=data[i]:

here you're using i as though it were an index -- maybe use
          if num!=i

Emile

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to