Commit abe9bd94 by BellCodeEditor

save project

parent 34d15143
Showing with 11 additions and 7 deletions
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
# 如果偷回的宝石数是1-3颗,输出结果:可以全员出动,殊死一搏 # 如果偷回的宝石数是1-3颗,输出结果:可以全员出动,殊死一搏
# 如果偷回的宝石数是0颗,输出结果:没办法了,只能尝试呼叫惊奇队长 # 如果偷回的宝石数是0颗,输出结果:没办法了,只能尝试呼叫惊奇队长
# 但是运行错误了,请你帮助悟空消灭bug! # 但是运行错误了,请你帮助悟空消灭bug!
stonenumber=0 scores ={'语文':89,'数':95, '英语':80}
if stonenumber >= 4:
print('获得了打败灭霸的力量,反杀稳了') def get_average(scores):
elif 1<=stonenumber <= 3: sum_score = 0 # sum_score 作为函数内部的局部变量,从而可以为函数所用
print('可以全员出动,殊死一搏') for subject, s in scores.items():
else: sum_score = s+sum_score
print('没办法了,只能尝试呼叫惊奇队长') print('现在的总分是%d'%sum_score)
ave_score = sum_score/len(scores)
print('平均分是%d'%ave_score)
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