diff --git a/diy1.py b/diy1.py index eefeb2c..09f4361 100644 --- a/diy1.py +++ b/diy1.py @@ -3,14 +3,14 @@ scores = {'语文':89, '数学':95, '英语':80} -def get_average(dict_1)): - score = 0 +def get_average(dict_1): + sum _score = 0 for subject, score in scores.items(): - score += score - print('现在的总分是%d'%score) - ave_score = score/len(scores) + sum_score += score + print('现在的总分是%d'%sum_score) + ave_score = sum_score/len(scores) print('平均分是%d'%ave_score) get_average(scores) \ No newline at end of file diff --git a/diy4.py b/diy4.py new file mode 100644 index 0000000..af41d54 --- /dev/null +++ b/diy4.py @@ -0,0 +1 @@ +print((89+95+80)/3)