Median Program in Python || Calculate the Median of a list in Python

Опубликовано: 21 Февраль 2026
на канале: Zeeshan_Tutorial
99
17

Median is defined as the value which is present in the middle for a series of values. Note, in order to find the median of an array of integers, we must make sure they are sorted.
Example 1:
Input: [2,4,1,3,5]
Output: 3

Example 2:
Input: [2,5,1,7]
Output: 3.5

Approach :
Sort the array in ascending order
Check whether n is odd or even
Calculate the median accordingly. Here’s a quick demonstration of the same

Don't forget to like, share, and subscribe to Zeeshan_Tutorial for more educational content like this. If you have any questions or suggestions, please leave them in the comments below. Thanks for watching, and let's dive into the world of prime numbers!

#python
#median
#Zeeshan_Tutorial