Commit 3d94753f by BellCodeEditor

auto save

parent 04e717b8
Showing with 51 additions and 5 deletions
......@@ -3,14 +3,15 @@
scores = {'语文':89, '数学':95, '英语':80}
def get_average(dict_1)):
score = 0
def get_average(scores):
sum = 0
for subject, score in scores.items():
score += score
print('现在的总分是%d'%score)
ave_score = score/len(scores)
sum += score
# print(sum )
print('现在的总分是%d'%sum)
ave_score = sum/len(scores)
print('平均分是%d'%ave_score)
get_average(scores)
\ No newline at end of file
a=['a','b','c']
#字典定义 b 语文:88,数学:99 ,英语:100
b={'语文':88,'数学':99,'英语':100}
c={'张三':b}
print(c)
'''
#读取数学成绩
# print(b['数学'])
#增加 体育60
b['体育']=60
#print(b)
#将语文成绩修改为99
b['语文'] =99
#删除数学
b.pop('数学')
# print(b)
#遍历字典 键名,值
# for k,v in b.items():
# print(k,v)
#遍历字典的 键名
# for k in b.keys():
# print(k)
#遍历字典的值
for v in b.values():
print(v)
'''
# 原代码:
city = ['纽约','华盛顿','桃源岛','洛杉矶','芝加哥','旧金山']
area=input('你想去哪里啊?')
if area in city:
print('可以乘坐飞机通往'+area)
else:
print('没有'+area+'这座城市')
a=10
def fun1():
a=3
print(a)
def fun2():
b=a+4
print(b)
fun2()
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