#Python 3位學生,每位學生都有5科成績,使用dict()
dic = {}
for k in range(3):
print(“#%d student:” %(k+1))
scoreLst = []
for i in range(5):
score = eval(input())
scoreLst.append(score)
dic[k]=scoreLst
print(dic)
for k in range(3):
sum1=sum(dic[k])
avg=sum1/5
print(“Student %d: sum = %d , average = %.2f “\
%((k+1),sum1,avg))
#三位學生分數輸入1, 2, 3, 4, 5不同排列
#總分15分,平均3分
近期留言