Question: write function called list_median that takes a list and returns a new list. If the list has even numbers of elements, the new list will

write function called list_median that takes a list and returns a new list. If the list has even numbers of elements, the new list will have two elements. If the list has odd numbers of elements,
the new list will include only one element. For example:
>>> t1 = [5, 1, 2, 3, 4]
>>> list_median(t1)
[3]
>>> t2 = [8, 3, 10, 6]
>>> list_median(t2)
[6, 8]

Step by Step Solution

3.36 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can create a listmedia n function in Python that takes a list and returns a new li... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!