Median


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/5?curriculum_id=4f89dab3d788890003000096#


i do not understand why it has to show 3.5



`


#2

Median is the middle value of a data set. To calculate it you have to sort the list and return the middle value (if the length of the list is odd) or the mean of two middle values (if the length is even).

So, to calculate the median of [1, 34, 1, 6, 8, 0] you have to:
1. sort the list ([0, 1, 1, 6, 8, 34]);
2. return the mean of two middle values (1 and 6; (1 + 6) / 2 = 3.5).


#3

stupidest way,best way.:joy:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.