/SEG-2022-23-medians-toggysmith

SEG-2022-23-medians-toggysmith created by GitHub Classroom

Primary LanguagePython

Median

Sample code

This repository contains a file called median.py. It contains code that asks the user to enter a list of numbers. If the user enters a list of numbers, such as:

Enter a list of numbers separated by commas:
0, 0, 120, 234, 1

It prints out those numbers as a list:

[0.0, 0.0, 120.0, 234.0, 1.0]

Assignment

Your assignment in this exercise is to change the code such that it returns the median of the list.

The median of a set of numbers is the middle number, that separates the lower half from the higher half. The median of the following set of 7 numbers

1, 2, 3, 3, 6, 10,12

is 3, because that is the middle number. When the list contains an even number of values, the median is the arithmetic mean of the two middle numbers. For example, the median of:

1, 2, 3, 6, 10, 12

is 4.5, because that is the arithmetic mean of 3 and 6,

How to complete the exercise

To start work on the exercise, find the URL of this repository on GitHub and clone it to your machine with:

$ git clone URL

where URL is the URL of your repository on GitHub. Find the median.py file and complete your solution.

Once your exercise is complete, you need to push your repository with:

$ git push

GitHub will automatically test your solution.