Question: Write a function that accepts a list of integers. The return value of the function will be the median of the list. You are not

Write a function that accepts a list of integers. The return value of the function will be the median of the list. You are not allowed to change the list -- this includes the order of the list.
The median is the middle point in a datasethalf of the data points are smaller than the median and half of the data points are larger.
To find the median:
Arrange the data points from smallest to largest.
If the number of data points is odd, the median is the middle data point in the list.
If the number of data points is even, the median is the average of the two middle data points in the list.
There should be three sections with a comment label: Input, Processing, and Output - the code should be beneath the comment.
Input -- code that gathers information from the user.
Processing -- code that uses the input to support the output.
Output -- code that displays the results.
The following data types are allowed: string, integer, float, and Boolean.
Only print statements are allowed in the Output section - each print statement is permitted a single string literal with variables. The variables may be in-line or in a format list. Print statements with expressions are not allowed this includes functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!