以字典的方式完成一个小型的学生管理系统

##需求:

##学生有下面几个属性:姓名,年龄,考试分数包括:语文,数学,英语得分。
##比如定义2个同学:
##姓名:小明,年龄18,考试分数:语文90,数学85,英语80
##姓名:小红,年龄20,考试分数:语文70,数学92,英语85分

1 student_info = {'xiaoming':{'name':'小明', 'age':18, 'score':{'chinese':90, 'math':85, 'english':80}}}
2 student_info['xiaohong'] = {'name':'小红', 'age':20, 'score':{'chinese':70, 'math':92, 'english':85}}
3 print(student_info['xiaohong']['score']['math'])    # 查找小红的数学成绩
View Code
原文地址:https://www.cnblogs.com/panisme/p/8227522.html