Mark Dickinson <[EMAIL PROTECTED]> writes: > def mean(number_list): > return sum(number_list)/len(number_list) > > If you pass a list of floats, complex numbers, Fractions, or Decimal > instances to mean() then it'll work just fine. But if you pass > a list of ints or longs, it'll silently return the wrong result.
So use: return sum(number_list) / float(len(number_list)) That makes it somewhat more explicit what you want. Otherwise I wouldn't be so sure the integer result is "wrong". -- http://mail.python.org/mailman/listinfo/python-list