Sort by

recency

|

3888 Discussions

|

  • + 0 comments

    if name == 'main': n = int(input()) student_marks = {} for _ in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = input()

    NUM = student_marks[query_name]
    NUM = float((NUM[0] + NUM[1] + NUM[2]) / 3)
    
    print("{:.2f}".format(NUM))
    
  • + 0 comments
    x = student_marks[query_name]
    print(f'{sum(x)/len(x):.2f}')
    
  • + 0 comments
    if __name__ == '__main__':
        n = int(input())
        student_marks = {}
        for _ in range(n):
            name, *line = input().split()
            scores = list(map(float, line))
            student_marks[name] = scores
        query_name = input()
        s = 0 
        n = 0 
        for nums in student_marks[query_name]:
            s += nums
            n += 1
        print(f"{s/n:.2f}")
    
  • + 0 comments
    scores = list(student_marks[query_name])
        total = sum(scores)
        average = total/len(scores)
        print('%.2f'%average)
    
  • + 0 comments

    if name == 'main': n = int(input())

    student = {}
    
    for _ in range(n):
        name, *line = input().split()
        scores = list(map(float, line))
        student[name] = scores
    
    avgForStudent = input()
    
    #iterating through all items in dict and calculating avg for all
    for k, v in student.items():
        #calculating avg for all keys present in dict
        student.update({k : sum(v)/len(v)})
    
    
    average = student.get(avgForStudent)
    print(f"{average:.2f}")