Sort by

recency

|

548 Discussions

|

  • + 0 comments
    N,X = map(int, input().split())
    marks = list()
    
    for i in range(X):
        marks.append(map(float, input().split()))
        
    for student_marks in list(zip(*(marks))):
        print(sum(student_marks)/X)
    
  • + 0 comments

    Here is HackerRank Zipped! in Python solution - https://programmingoneonone.com/hackerrank-zipped-problem-solution-in-python.html

  • + 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.

  • + 0 comments
    N,X = map(int, input().split())
    [print(sum(z)/X) for z in zip(*[list(map(float,input().split())) for i in range(X)])]
    
  • + 0 comments
    n, x = map(int, input().split(' '))
    marks= [ list(map(float, input().split())) for _ in range(x)]
    print(*[sum(i)/x for i in zip(*marks)], sep='\n')