Commit e79c21de by BellCodeEditor

save project

parent 9c4fa246
Showing with 11 additions and 10 deletions
# 假期到了,诺依想出去玩,但不知道有没有飞机直达那里, scores = {'语文':89, '数学':95, '英语':80}
# 悟空做了个小程序帮助诺依,然而代码出现了3处错误。
# 请你找出来,并运行~ def get_average(scores):
city = ['纽约','华盛顿','桃源岛','洛杉矶','芝加哥',旧金山] sum_score = 0 # sum_score 作为函数内部的局部变量,从而可以为函数所用
raise=input('你想去哪里啊?') for subject, score in scores.items():
if raise in city sum_score += score
print('可以乘坐飞机通往'+raise) print('现在的总分是%d'%sum_score)
else: ave_score = sum_score/len(scores)
print('没有'+raise+'这座城市') print('平均分是%d'%ave_score)
\ No newline at end of file
get_average(scores)
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