[Tutor] toggle through a list
Emile van Sebille
emile at fenx.com
Thu Apr 2 02:35:52 CEST 2009
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
More information about the Tutor
mailing list