Skip to content

Latest commit

 

History

History
8 lines (5 loc) · 443 Bytes

File metadata and controls

8 lines (5 loc) · 443 Bytes

Given a list of positive integers that are sorted in ascending order, write a function median_num(nums : List[int]) → float that determines the median of the list.

Note: The median is the “middle number ” of a list if the length of the list is odd. The median is the “two middle numbers ” / 2 if the length of the list is even.

For example:

  • median_num([1,3,3,6,7,8,9]) → 6
  • median_num([1,2,3,4,5,6,8,9]) → 4.5