From 8718ca9df71a4bce5344624254636b4ded3890cc Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 17 Oct 2021 11:37:18 +0800 Subject: [PATCH] save project --- diy1.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/diy1.py b/diy1.py index ce831b6..0d2723a 100644 --- a/diy1.py +++ b/diy1.py @@ -2,13 +2,12 @@ # 于是写了下面的代码,可是总是得不到结果,请帮纠正bug并跑通程序。 scores = {'语文':89, '数学':95, '英语':80} - def get_average(scores): - score = 0 + sum = 0 for subject, score in scores.items(): - score += score - print('现在的总分是%d'%score) - ave_score = score/len(scores) + sum = score + sum + print('现在的总分是%d'%sum) + ave_score = sum/len(scores) print('平均分是%d'%ave_score) get_average(scores) \ No newline at end of file -- libgit2 0.25.0