#K53497. Average Student Grades
Average Student Grades
Average Student Grades
You are given data for a number of students, each with a list of their exam grades. Your task is to compute the average grade for each student, rounded to two decimal places. If a student does not have any grades, the average grade is 0.00.
The average is computed using the formula:
\( \text{average} = \frac{\text{sum of grades}}{\text{number of grades}} \)
You need to read the student data from standard input and output the results to standard output in the format:
student_name: average_grade
where average_grade
is formatted to exactly two decimal places.
inputFormat
The input is read from standard input and has the following format:
- The first line contains an integer N, denoting the number of students.
- The following lines contain data for each student in blocks:
- The first line of each block contains the student's name (a string) followed by an integer M indicating the number of grades.
- If M is greater than 0, the next line contains M space-separated integers representing the student's grades.
For example:
4 Alice 3 90 85 88 Bob 3 70 80 75 Charlie 0 David 2 95 92
outputFormat
For each student (in the order they are given), output a single line in the following format:
student_name: average_grade
The average_grade
must be rounded to two decimal places. For example:
Alice: 87.67 Bob: 75.00 Charlie: 0.00 David: 93.50## sample
4
Alice 3
90 85 88
Bob 3
70 80 75
Charlie 0
David 2
95 92
Alice: 87.67
Bob: 75.00
Charlie: 0.00
David: 93.50
</p>