1、通讯录
dicTXL = {"小新": {"手机": "13913000001", "QQ": "18191220001"},
"小亮": {"手机": "13913000002", "QQ": "18191220002"},
"小刚": {"手机": "13913000003", "QQ": "18191220003"}}
dicOther = {"大刘": {"手机": "13914000001", "QQ": "18191230001"},
"大王": {"手机": "13914000002", "QQ": "18191230002"},
"大张": {"手机": "13914000003", "QQ": "18191230003"}}
dicTXL.update(dicOther)
dicWX = {"小新": "xx9907", "小刚": "gang1004", "大王": "jach_w", "大刘": "liu666"}
for k,v in dicTXL.items():
dicTXL[k]["微信"] = dicWX.get(k,dicTXL[k]["手机"])
dicTXL["大王"]["手机"]="13914000004"
name = input("请输入同学姓名:")
if name in dicTXL:
print("{}同学手机号为{},QQ号为{},微信号为{}".format(name,dicTXL[name]["手机"],dicTXL[name]["QQ"],dicTXL[name]["微信"]))
else:
print("没有该同学的联系方式")
2、校园好声音
dicscore = {"012": [90, 94, 97, 86, 85, 89, 88, 85],
"005": [91, 91, 92, 98, 90, 96, 90, 95],
"108": [96, 86, 97, 96, 87, 86, 86, 96],
"037": [95, 95, 94, 93, 97, 98, 99, 95],
"066": [95, 87, 94, 94, 93, 99, 96, 97],
"020": [89, 97, 91, 95, 89, 94, 97, 92]}
ls = [(round((sum(v)-max(v)-min(v))/(len(v)-2),2),k) for k,v in dicscore.items()]
ls.sort(reverse=True)
dicscore = [(k,v) for v,k in ls]
print(dicscore)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)