In [1]:
grade = {'A+': 1, 'A ': 3,
         'A-': 2, 'B+': 6,
         'B ': 6, 'B-': 3,
         'C+': 2, 'C ': 0,
         'D ': 0, 'D-': 0, 'F ': 0}
In [2]:
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}
In [3]:
n = sum(grade.values())
print('GPA制度(11段階評価)対象者数:', n)
GPA制度(11段階評価)対象者数: 23
In [4]:
val = sum([grade[x]*gpa[x] for x in grade.keys()])/n
print('平均GP:', val)
平均GP: 3.2260869565217387
In [5]:
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()