Finding the percentage

Finding the percentage

Instructor-svgAl-Mamun Sarkar
Mar 23 , 2020

Finding the percentage Python Basic Data Type of HackerRank.

Code:

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 = sum(student_marks[query_name]) / 3
    print("{:.2f}".format(avg))

Test Input:

3
Krishna 67 68 69
Hridoy 70 98 63
Mohona 52 56 60
Mohona

Test Output:

56.00
  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram