Challenge 2: Find Mean and Median

Given a file containing a list of numbers, output a file that contains the mean and median of those numbers.

Problem Statement

Write a code that takes a list of numbers as input from data.txt file, finds the mean and median of those numbers, and outputs them on the output/outData.txt file.

Input

A file data.txt containing a list of numbers.

Output

A file output/outData.txt containing the mean and median of the input numbers.

Sample Input

data.txt

3
8
1

Sample Output

output/outData.txt

4
3

Test Yourself

Write your code in the given area. If you get stuck, you can look at the solution.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy