Collections.namedtuple()

Sort by

recency

|

1044 Discussions

|

  • + 0 comments
    if __name__ == "__main__":
        n, idx = [int(input()), input().split().index("MARKS")]
        marks = [int(input().split()[idx]) for i in range(n)]
        print (f"{(sum(marks)/n):.2f}")
    
  • + 0 comments
    from collections import namedtuple
    N = int(input())
    data = namedtuple('data', input())
    print(sum([int(data(*input().split()).MARKS) for _ in range(N)])/N)
    
  • + 0 comments
    from collections import namedtuple
    
    N = int(input())
    Data = namedtuple('Data',input())
    sp = [Data(*input().split()) for i in range(N)]
    print(f"{sum([int(i.MARKS) for i in sp])/N:.2f}")
    
  • + 0 comments
    from collections import namedtuple
    
    N=int(input())
    sum_marks=0
    Student=namedtuple('Student',input().split())
    for i in range(N):
        row=input().split()
        xyz=Student(*row)
        sum_marks+=int(xyz.MARKS)
    print("{:.2f}".format((sum_marks/N)))
    # print(f'{(sum_marks/N):.2f}')
    
  • + 0 comments
    from collections import namedtuple
    
    lines_count, Student = int(input()), namedtuple('Student', input())
    print(sum([int(Student(*input().split()).MARKS) for _ in range(lines_count)]) / lines_count)