Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Data Analysis Data Analysis Basics Getting to Know Your Data Getting Friendly with Data

The video does not mention what to do in this scenario - Median where result is represents another object.

The video says something like ~"for finding median of an even amount of data from a dataset, take the two middle data results and get their average."

Since the test says something like "A classroom had the following distribution of grades: 30 As, 10 Bs, 8 Cs, and 2 Ds. What was the median grade?", this would mean the result is 9. Saying "B" is wrong. I asked an AI, to which it replied with "since theyre tied, the answer is "C". I asked the AI if in a tie, you should always go with the smaller result if the dataset represents another object(like votes, grades, cars, etc) and the AI said "always get the average of the two in the middle". I just want to know how to handle this type of data in the future.

--EDIT-- Its worth mentioning that I refreshed and reanswered two more times. The answer was A??????? How is 30 the median?

1 Answer

Steven Parker
Steven Parker
231,236 Points

AI systems are notoriously unreliable, and this one obviously has no idea what the term "median" means in regards to statistics. There is no kind of "tie" here at all.

A "median" is simply the middle value (not the average) when the items are sorted. Since in this case there are 30 "A"s, and a total of 20 other values, the ones in the middle will both be "A"s.

The AI was right about one thing, that since there is no single "middle" value when the set has an even number of items, you take the average of the two middles. But in this case they are both "A"s, and the average of two identical values is the same as either of the values. So the correct answer is "A".

Okay. I get it now. I want to leave a comment in case someone is coming from a programming background like me. In my mind, they wanted the median letter grade based on available results, I saw 4 values in total... 30, 10, 8, and 2 ...if looked at like that, 9 was the median in my head. If the answer was 10, then the answer would be "B".

But what youre saying makes sense. They literally meant the median of all the letter grades.. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBCCCCCCCCDD ...which is "A"

Thanks Steven. Makes a lot more sense now that you have explained it.