Discuss Scratch

1Bluemoose
Scratcher
5 posts

Calculateing the mode of a data set

Hello! I have recently been making a program the calculates the mean, median, mode and range of a data set. I have figured out how to calculate the mean, median and range, but I am stumped when it comes to the mode. You can view the project here

Any help is appreciated. Thanks

-1Bluemoose
drmcw
Scratcher
1000+ posts

Calculateing the mode of a data set

SImplest but not particularly efficient way would be to go through each item in the list then go through the list for each item but skipping the item you are checking and add up all occurences. The item with the highest number of occurences is the mode.
1Bluemoose
Scratcher
5 posts

Calculateing the mode of a data set

I get what you mean and have been thinking about this for a while but I cant seem to wrap my head around how you would code that. Can you provide a code example / better explination?

-1Bluemoose

add1BluemoosetoCool Scratchersif1Bluemoose=Awesomethensaygoto: bit.ly/1Bluemoose
drmcw
Scratcher
1000+ posts

Calculateing the mode of a data set

1Bluemoose
Scratcher
5 posts

Calculateing the mode of a data set

Ok, great thanks!

Powered by DjangoBB