Sort by

recency

|

3775 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()

    avg = 0.00
    num = 0.00
    for f in student_marks[query_name]:
        num = num + 1
        avg = avg +f
    
    avg = avg / num
    
    print("{:.2f}".format(avg))
    
  • + 0 comments

    average = sum(student_marks[query_name])/len(student_marks[query_name]) print("%.02f"%average)

  • + 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()
        
        # calculate the average of teh required student
        marks = student_marks[query_name]
        average = sum(marks)/len(marks)
        print(f'{average:.2f}')
    
  • + 0 comments
    if __name__ == '__main__':
        n = int(input())
        student_marks = {}
        total = 0 
        for _ in range(n):
            name, *line = input().split()
            scores = list(map(float, line))
            student_marks[name] = scores
        query_name = input()
    
        scorelist = student_marks[query_name]
        
        for i in scorelist:
            total += i
        
        average = total/len(scorelist)
        print("{:.2f}".format(average))
    
  • + 0 comments

    This code stub addresses a common programming problem effectively. Calculating the average of marks for a given student and formatting it to two decimal places is a practical exercise Ekbet9 id