Open this example in the interactive library
Source code
from statistics import median
print(median([9, 1, 5, 3]))Sample output
4.0

Calculate a median. A self-contained example using the Python standard library.
Open this example in the interactive library
from statistics import median
print(median([9, 1, 5, 3]))4.0