CS209 lab7


http://www.maths.nuigalway.ie/~gettrick/teach/cs209/l7.html




  1. You should first experiment with some of the simple programs at http://www.maths.nuigalway.ie/~gettrick/teach/cs209/progs/.
  2. Write a program in PYTHON that calculates the median of a set of distinct input integers. The median is some number x such that half the numbers are above x and half below. For example,
    • median of 1,3,5,7 is 4
    • median of 1,2,2,7 is 2
    • median of 1,2,3,7 is 2.5
    (note - as in the last example - the median may not necessarily be an integer).
  3. You may choose, as you wish, to read the numbers in from the user when you run your program or to read them in from a file.

© NUI, Galway