Knowee
Questions
Features
Study Tools

The first line contains the integer , the number of students' records. The next lines contain the names and marks obtained by a student, each value separated by a space. The final line contains query_name, the name of a student to query.ConstraintsOutput FormatPrint one line: The average of the marks obtained by the particular student correct to 2 decimal places.

Question

The first line contains the integer , the number of students' records. The next lines contain the names and marks obtained by a student, each value separated by a space. The final line contains query_name, the name of a student to query.ConstraintsOutput FormatPrint one line: The average of the marks obtained by the particular student correct to 2 decimal places.

🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like you're asking for a Python solution to a problem where you have a list of student records and you want to find the average mark of a particular student. Here's a step-by-step solution:

  1. First, we need to get the number of student records. We can do this using the input() function in Python, which reads a line of text from the user. Since this function returns a string, we need to convert this to an integer using the int() function.
n = int(input())
  1. Next, we need to read the student records. We can do this in a loop that runs n times. In each iteration of the loop, we read a line of text, split it into a name and a mark, and store it in a dictionary.
records = {}
for _ in range(n):
    name, *marks = input().split()
    marks = list(map(float, marks))
    records[name] = marks
  1. Then, we need to read the name of the student to query. We can do this using the input() function again.
query_name = input()
  1. Finally, we need to compute and print the average mark of the queried student. We can do this by summing up the marks of the student (using the sum() function) and dividing by the number of marks (using the len() function). We use the format() function to print the result with 2 decimal places.
average = sum(records[query_name]) / len(records[query_name])
print("{:.2f}".format(average))

This is the complete Python program:

n = int(input())
records = {}
for _ in range(n):
    name, *marks = input().split()
    marks = list(map(float, marks))
    records[name] = marks
query_name = input()
average = sum(records[query_name]) / len(records[query_name])
print("{:.2f}".format(average))

This problem has been solved

Similar Questions

The first line contains an integer, , the number of students.The subsequent lines describe each student over lines.- The first line contains a student's name.- The second line contains their grade.ConstraintsThere will always be one or more students having the second lowest grade.Output FormatPrint the name(s) of any student(s) having the second lowest grade in. If there are multiple students, order their names alphabetically and print each one on a new line.

The only line contains space-separated integers, and .ConstraintsSample Input 05 4Sample Output 0233Explanation 0All possible values of and are:The maximum possible value of that is also is , so we print on first line.The maximum possible value of that is also is , so we print on second line.The maximum possible value of that is also is , so we print on third line.

Enter the student details using constructors with arguments. Then find the total marks of each student. If it is greater than 500 print pass ,else print fail.

The first line contains a string, .The second line contains the width, .ConstraintsSample Input 0ABCDEFGHIJKLIMNOQRSTUVWXYZ4Sample Output 0ABCDEFGHIJKLIMNOQRSTUVWXYZ

Akulya has received her semester results. The performance in the exam is graded with letters S, A, B, C, D, E, and F. Help her to understand the mark range for a grade with respect to the mark obtained in the exam .  Input FormatRead the course nameRead the markOutput FormatPrint the course namePrint the markPrint the GradeSample InputICSE102L89Sample OutputICSE102L89A GradeInput

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.