Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programming, Task 1: Write a function median(list name) that takes a list of numbers as an argument and returns the median value. Your function

python programming,

image text in transcribed

Task 1: Write a function median(list name) that takes a list of numbers as an argument and returns the median value. Your function should work for any list of numbers If there is an odd number of data values, the median will be the value in the middle of the sorted list. If there is an even number of data values, the median is the mean (or average) of the two data values in the middle of the sorted list. So,for the data set [1, 1, 2, 5, 6,6,91, the median is 5. For the data set [1, 1,2, 6, 6, 91, the median is 4. DO NOT assume that the list argument passed to your function will be in sorted order Tips: To sort a list: use the built-in Python function, sorted). Following is an example typed into the Python shell >>myList [5, 4, 10, 6, 7, 8,9,1, 2] >>sorted(myList) [1,2,4,5,6,7,8,9,10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions