Python Problem Solving
2/ 30 Day Solution #python #pythonproblemsolving #30daycodingchallenge #30daychallenge #problemsolving
if name == '__main__':
# taking input from user of how many elements(names) to add in dictionary
n = int(input())
# initiating a dictionary which store the marks as set of marks
student_marks = {}
# looping the process of taking input and storing the students name and marks data in dictionary
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
# taking input from user for which name we have to calculate the average marks
query_name = input()
# intializing a set to store marks
scores = {}
# iterating through each marks the set
for name in student_marks:
if name == query_name:
scores = student_marks[query_name]
sum = 0
for score in list(scores):
sum += score
print("{:.2f}".format(sum/len(list(scores))))