In this HackerRank Collections, namedtuple () problem solution Dr. John Wesley has a spreadsheet containing a list of student's IDs, marks, class, and names. Our task is to help Dr. Wesley calculate the average marks of the students.


HackerRank Collections.namedtuple() in python problem solution

HackerRank Collections.namedtuple() problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
from collections import namedtuple
n = input()
Info = namedtuple('Info', raw_input())
s = ''
sum = 0
for x in range(n):
    a,b,c,d = raw_input().split()
    s = Info(a,b,c,d)
    sum += int(s.MARKS)
print round(sum/float(n),2)