Emergency room wait-time summary
A hospital in Nairobi tracks how long patients wait in the emergency room. The administrator wants one line that summarises a shift: the mean, the median, the most common wait and the spread.
Task: read one line of waiting times in minutes (integers separated by spaces, at least one value). Print a single line in exactly this format: mean=A median=B mode=C variance=D. The mean, median and variance are printed with 2 decimals. The median of an even number of values is the average of the two middle values. If several values share the highest frequency, the mode is the smallest of them (print it as an integer). The variance is the population variance: the average of the squared differences from the mean (divide by n).
Sample tests
Input
35 20 45 20 60 35 50
Expected output
mean=37.86 median=35.00 mode=20 variance=191.84
Input
10 20 30 40
Expected output
mean=25.00 median=25.00 mode=10 variance=125.00
Your answer is also checked against 3 hidden tests.
Log in or create a free account to run your code, submit and earn points.
Run your code to see the output here. Ctrl + Enter also runs it.
