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:
if num!=data[i]: num=data[i] count=count+1
else : count=count+1 if count>mx: mx=count mode=num
print 'The mode is: ',mode def median(lst): x=len(data) y=x/2
print 'The median is: ',data[y]def getlst(): num=[] while True:
s=raw_input('please enter a series of number to evaluate') if
s=='':break num.append(eval(s)) return numdef avg(y): sum(y)
print'the average is: ', sum/len(y)data=getlst()median(data)avg(data)_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor