def calculate_average_grade(grades_dictionary):
grades_avg = {}
for key in grades_dictionary.keys():
average = sum(grades_dictionary[key]) / len(grades_dictionary[key])
grades_avg[key] = average
return grades_avg
grades_dictionary = readGrade
avg_grade = calculate_average_grade(grades_dictionary)
print(f' {readGrade} => {avg_grade}')
I need this code to print output separately like {"XYZ": [3,2,4,5]} ==> {"XYZ": 3.5}
My code outputs together like-
{'PQR': [4.0, 4.0, 4.5, 2.5, 4.5, 3.5], 'LMN': [4.0, 4.0, 3.0, 3.0, 3.0, 3.5]}) => {'PQR': 3.8333333333333335, 'LMN': 3.4166666666666665}