Collections.namedtuple()

Sort by

recency

|

1094 Discussions

|

  • + 0 comments

    from collections import namedtuple n = int(input()) student = namedtuple('student', list(input().split())) summ = (lambda n: sum(float(student(*(input().split())).MARKS) for _ in range(n)))(n) print(f"{summ/n:.2f}")

  • + 0 comments

    from collections import namedtuple

    n=int(input()) title=input().split() student=namedtuple('student',title) total=0 for _ in range(n): data=input().split() S=student(*data) total+=int(S.MARKS) print(total/n)

  • + 1 comment
    from collections import namedtuple
    n, cols = int(input()), input().split()
    Student = namedtuple('Student', cols)
    print(f"{sum(int(Student(*input().split()).MARKS) for _ in range(n))/n:.2f}")
    
  • + 0 comments
    from collections import namedtuple
    n, marksheet = int(input()),namedtuple('student', input().split())
    entry = [marksheet(*input().split()) for _ in range(n)]
    print(sum(int(e.MARKS) for e in entry)/n)
    
  • + 0 comments
    from collections import namedtuple
    N = int(input())
    Student = namedtuple('Student', input().split())
    students = [Student(*input().split()) for _ in range(N)]
    marks = sum([int(s.MARKS) for s in students])
    average = marks / N
    print(f"{average:.2f}")