Median Updates Hackerrank Solution Python