From the course: Programming Foundations: Numerical Mathematics and Calculations
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Calculating the median - Python Tutorial
From the course: Programming Foundations: Numerical Mathematics and Calculations
Calculating the median
- [Instructor] Another kind of average is median, often spoken in news. For example, the median household income in US was $70,000 in 2021. How is it calculated? It is calculated in two steps. The first step includes sorting the list of numbers in ascending order. The second step has branching depending on if the length of the list of numbers is odd or even number. If it is odd, then the median is the number in the middle of the list. If it is even, then we calculate the median by taking the mean of the two middle numbers. Let's see how to calculate it in an example. Suppose we have the age of employees listed below. We'll arrange them in ascending order. We have seven elements in the list so the length of the list is seven. It's an odd number, then the median is the number in the middle of the list. That's, in our case, 42. What would our median be if it would leave out the last number, 58, from the list? In…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Calculating the mean3m 32s
-
(Locked)
Calculating the median2m 59s
-
(Locked)
Finding the mode and creating a frequency table2m 54s
-
(Locked)
Measuring the dispersion and finding the range of a set of numbers2m 57s
-
(Locked)
The variance and standard deviation2m 41s
-
(Locked)
Challenge: Creating a grouped frequency table57s
-
(Locked)
Solution: Creating a grouped frequency table1m 34s
-
(Locked)
-
-