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.
We'll cover the following
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.
main.r
data.txt
# Write your code here
Let’s look at the solution review of this challenge in the next lesson.