Commit dd43d3ae by BellCodeEditor

save project

parent 29b8ae85
Showing with 11 additions and 1 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# 于是写了下面的代码,可是总是得不到结果,请帮纠正bug并跑通程序。 # 于是写了下面的代码,可是总是得不到结果,请帮纠正bug并跑通程序。
scores = {'语文':89, '数学':95, '英语':80} scores = {'语文':89, '数学':95, '英语':80}
scores1 = {'物理':1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, '生物':90000000000000000000000000000000000000000000000000000000000000000000000000, '化学':800000000000000000000000000000000000000000000}
def get_average(scores): def get_average(scores):
x = 0 x = 0
for subject, score in scores.items(): for subject, score in scores.items():
...@@ -12,3 +12,12 @@ def get_average(scores): ...@@ -12,3 +12,12 @@ def get_average(scores):
print('平均分是%d'%ave_score) print('平均分是%d'%ave_score)
get_average(scores) get_average(scores)
def get_average(scores):
y = 0
for subject, score in scores.items():
x =x + score
print('现在的总分是%d'%x)
ave_score = x/len(scores)
print('平均分是%d'%ave_score)
get_average(scores)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment