We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
fromcollectionsimportnamedtuple#take in the inputpeople=[input().split()foriinrange(int(input())+1)]heading=''#to get the second parameter in the namedtupleforiinpeople[0]:heading=heading+i+' 'total=0#defining the named_tuplestudents=namedtuple('students',heading)#calculating the totalforiinrange(1,len(people)):temp_tuple=students(people[i][0],people[i][1],people[i][2],people[i][3])total=total+int(temp_tuple.MARKS)to_divide=len(people)-1#printing out the averageprint(float(total/to_divide))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.namedtuple()
You are viewing a single comment's thread. Return to all comments →