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.
please tell me where I'm getting wrong . I'm getting one decimal after point and expected output is 2decimal after point
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()
temp = []
total = 0
for key, value in student_marks.items():
if query_name == key:
temp += student_marks.get(query_name)
count = 0
for i in temp:
count+=1
total += i
avg = round(total/count, 3)
print(avg)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Finding the percentage
You are viewing a single comment's thread. Return to all comments →
please tell me where I'm getting wrong . I'm getting one decimal after point and expected output is 2decimal after point 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()
temp = [] total = 0
for key, value in student_marks.items(): if query_name == key: temp += student_marks.get(query_name)
count = 0 for i in temp: count+=1 total += i avg = round(total/count, 3) print(avg)