[Tutor] mode??

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Jul 27 02:53:55 CEST 2004



On Mon, 26 Jul 2004, jason hochstein wrote:

> I am having trouble understanding how you would get a program to output
> the mode of a group of numbers. I got it to do the mean and median but
> if there are 7 n umbers and all are different how would you get a mode.
> Further more if there a re 7 numbers and 2 or 3 are the same, I
> understand thats the mode but how do you get it to output?


Hi Jason,

First, we have to make clear that this sounds like a homework problem, so
any help that you get from us will be limited mostly to references.  We
are not allowed to give homework answers.


Your question actually doesn't seem related to Python programming in
particular, but may have more to do with math definitions.

Can you define what you mean by "mode"?  The description you gave above is
making assumptions that we know what you mean by "mean", "median", and
"mode".  For the moment, I'll assume that:

    http://mathworld.wolfram.com/Mode.html

describes what you mean by 'mode'.


According to the definition in the Mathworld article, it's perfectly
possible to have multiple 'modes' for a given set of numbers.  Is this
what you expect?


Good luck to you.



More information about the Tutor mailing list