You are viewing a single comment's thread. Return to all comments →
This was my solution. No, I didn't solve it in one line but I'm new and to me this is easy to follow.
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() for key, value in student_marks.items(): if query_name == key: sum = 0 count = 0 for i in value: sum += i count += 1 average = sum/count print("{:.2f}".format(average))
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 →
This was my solution. No, I didn't solve it in one line but I'm new and to me this is easy to follow.