fn main() {

let mut nums: Vec<f32> = Vec::new();
    for i in 1..6 {
        nums.push((i * i) as f32);
        println!("\n=== numbers: {:?}", &nums);
        println!("mean   is {}", mean(&nums));
        println!("median is {}", median(&nums));
    }
}

fn mean(numbers: &Vec<f32>) -> f32 {
    let mut sum = 0.0;
    for num in numbers {
        sum += num;
    }
    sum / numbers.len() as f32
}

fn median(numbers: &Vec<f32>) -> f32 {
    let middle = numbers.len() / 2;
    if numbers.len() % 2 != 0 {
        numbers[middle]
    } else {
        (numbers[middle] + numbers[middle - 1]) / 2.0
    }
}