grade = {'A+': 1, 'A ': 3,
'A-': 2, 'B+': 6,
'B ': 6, 'B-': 3,
'C+': 2, 'C ': 0,
'D ': 0, 'D-': 0, 'F ': 0}
gpa = {'A+': 4.3, 'A ': 4.0,
'A-': 3.7, 'B+': 3.3,
'B ': 3.0, 'B-': 2.7,
'C+': 2.3, 'C ': 2.0,
'D ': 1.0, 'D-': 0.0, 'F ': 0}
n = sum(grade.values())
print('GPA制度(11段階評価)対象者数:', n)
val = sum([grade[x]*gpa[x] for x in grade.keys()])/n
print('平均GP:', val)
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['font.family'] = 'IPAPGothic'
plt.bar(range(len(grade)), list(grade.values()), align='center')
plt.xticks(range(len(grade)), list(grade.keys()))
plt.title('成績分布')
plt.show()