#K74377. Average Hours Studied
Average Hours Studied
Average Hours Studied
You are given a list of exactly 7 integers representing the number of hours studied each day over a week. Each integer must be between 0 and 24 inclusive. Your task is to compute the average number of study hours per day, rounding down (i.e. taking the floor of the average).
The formula for the average is given by:
$$\lfloor \frac{\text{sum of hours}}{7} \rfloor$$If the input does not consist of exactly 7 integers, or if any integer is outside the valid range, output the corresponding error message.
inputFormat
The input is provided on a single line with 7 space-separated integers. Each integer represents the hours studied on that day.
outputFormat
If the input is valid, output a single integer representing the floor of the average hours studied over the week. Otherwise, output one of the following error messages:
List must contain exactly 7 integers
if the number of integers is not equal to 7.All integers in hours must be between 0 and 24 inclusive
if any integer is not in the range [0,24].
5 6 7 8 4 5 7
6