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.
Finding the percentage
Finding the percentage
Sort by
recency
|
3770 Discussions
|
Please Login in order to post a comment
print(format(functools.reduce(lambda x,y: x+y,student_marks[query_name])/len(student_marks[query_name]),".2f"))
I had some problems. I wrote the code, the program works but the page rejects it. I only found the error after an hour XD. I had written 'print' between the lines so that I could observe during the writing of the function whether everything was happening as it should XDDD
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() if query_name in student_marks: Avg = student_marks.get(query_name) Sum= sum(Avg) vg=((float(Sum)) / float(3)) print("{:.2f}".format(vg))