Python namedtuple of collections module
Author: Al-mamun Sarkar
Date: 2020-03-26 13:09:35
Python namedtuple of collections module. The following code shows how to solve the HackerRank Collections.namedtuple() Python collections problem.
Code:
from collections import namedtuple
(n, categories) = (int(input()), input().split())
Grade = namedtuple('Grade', categories)
marks = [int(Grade._make(input().split()).MARKS) for _ in range(n)]
print((sum(marks) / len(marks)))