7 Replies - 652 Views - Last Post: 10 December 2012 - 08:52 AM Rate Topic: -----

#1 chan 06   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 67
  • Joined: 07-October 12

[Help] Finding the mode

Posted 10 December 2012 - 01:25 AM

I have been searching everywhere in Google, trying to figure out if there is a built-in function that you can find the mode of a list of the number in other words the most consist number appeared in list. I have created a random generator list from range 1 to 100.
Is This A Good Question/Topic? 0
  • +

Replies To: [Help] Finding the mode

#2 darek9576   User is offline

  • D.I.C Lover

Reputation: 204
  • View blog
  • Posts: 1,747
  • Joined: 13-March 10

Re: [Help] Finding the mode

Posted 10 December 2012 - 01:58 AM

The most consist number?
Do you mean the number that appears the most number of times in the list?
Was This Post Helpful? 0
  • +
  • -

#3 raghav.naganathan   User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 412
  • View blog
  • Posts: 1,449
  • Joined: 14-September 12

Re: [Help] Finding the mode

Posted 10 December 2012 - 02:03 AM

Yes, I think he means that...I believe the word he was trying to use was 'consistent' :)

regards,
Raghav
Was This Post Helpful? 0
  • +
  • -

#4 darek9576   User is offline

  • D.I.C Lover

Reputation: 204
  • View blog
  • Posts: 1,747
  • Joined: 13-March 10

Re: [Help] Finding the mode

Posted 10 December 2012 - 02:04 AM

You could look into a dictionary: your keys would be numbers and values would be the number of time they appear in the list.
Then, you take a key with the highest value.

Or you can create a simple class with 2 instance variables that will do the same as mentioned above.
Was This Post Helpful? 0
  • +
  • -

#5 chan 06   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 67
  • Joined: 07-October 12

Re: [Help] Finding the mode

Posted 10 December 2012 - 03:14 AM

Yes, I mean the most consistent value in the list, although in math terminology is usually called mode. And @darek9576, how to use dictionary?
Was This Post Helpful? 0
  • +
  • -

#6 darek9576   User is offline

  • D.I.C Lover

Reputation: 204
  • View blog
  • Posts: 1,747
  • Joined: 13-March 10

Re: [Help] Finding the mode

Posted 10 December 2012 - 03:16 AM

There are ton of resources about dictionaries on the internet.
Was This Post Helpful? 0
  • +
  • -

#7 Tayacan   User is offline

  • D.I.C Regular
  • member icon

Reputation: 145
  • View blog
  • Posts: 275
  • Joined: 18-January 11

Re: [Help] Finding the mode

Posted 10 December 2012 - 08:33 AM

Like this.
Was This Post Helpful? 0
  • +
  • -

#8 atraub   User is offline

  • Pythoneer
  • member icon

Reputation: 837
  • View blog
  • Posts: 2,271
  • Joined: 23-December 08

Re: [Help] Finding the mode

Posted 10 December 2012 - 08:52 AM

This sounds like a job for the Counter! You're in luck because I briefly talked about it and described it's usage here!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1