• + 0 comments

    Step 1: Read Input Values

    student_number, student_subject = map(int, input().split())

    • input().split() takes space-separated values as strings.
    • map(int, ...) converts these values into integers.
    • student_number represents the number of students.
    • student_subject represents the number of subjects.

    Step 2: Read Marks for Each Subject total_sum = [list(map(float, input().split())) for _ in range(student_subject)]

    for i in range(student_number):
    avg = sum(x[i] for x in total_sum) / student_subject print(f'{avg:.1f}')

    • - This is a list comprehension that iterates student_subject times.

    • - Each line of input is expected to contain space-separated marks of all students for one subject.

    • - map(float, input().split()) ensures marks are treated as floating-point numbers.

    • - total_sum now holds a list of lists, where each inner list represents a subject's marks across all students.