Challenge: Measures of Central Tendency (Ungrouped Data) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Challenge: Measures of Central Tendency (Ungrouped Data)

In your preferred language, write a program that returns the 'mean', 'median', and the 'mode' of any data set of numbers. The output of your results should contain the texts: The mean of the data set <list_data_set> is <mean>; The median is <median>; And the mode is <mode_or_modes_if_there_are_more_than_one_mode>. Endeavour to test your program with different data sets. God speed. [EDIT] Also if any of your results is in decimal, round it of to 2 decimal places, else return a whole number

5th Dec 2017, 5:50 AM
Power'f GOD⚡⚡
Power'f GOD⚡⚡ - avatar
3 Answers
+ 3
@Artem - Waoh. Nice. That's good. But one thing: Look at the EDIT part of my challenge. If any of your result is a whole number, it should output this, for instance, 5 and not 5.00. But iff it's a float/decimal, say 4.5678943564, let it be rounded off to 2 decimal places like this 4.57. You get the idea.
6th Dec 2017, 12:10 AM
Power'f GOD⚡⚡
Power'f GOD⚡⚡ - avatar
5th Dec 2017, 2:59 PM
Artem Bets
Artem Bets - avatar
+ 1
Well, I changed the code to take [EDIT] into account. But my personal opinion it is not a good idea to mix numbers with and w/o decimal points when you show them to the user. It looks not very clearly, and I still think that in this case it is better to show whole number as fractional.
6th Dec 2017, 7:31 AM
Artem Bets
Artem Bets - avatar