python使用列表存储学生信息(10条),;列表中每个元素表示一个学生信息,包括姓名、性别、年龄、班级、学号、语文、数学.
时间: 2023-11-08 17:47:18 浏览: 367
学生信息管理系统, 实现学生信息包括:学号、姓名、性别、年龄、班级等信息
5星 · 资源好评率100%
可以使用如下的代码来实现:
```python
students = [
{"name": "张三", "gender": "男", "age": 18, "class": "高三一班", "id": "20190101", "chinese": 95, "math": 90},
{"name": "李四", "gender": "女", "age": 17, "class": "高三一班", "id": "20190102", "chinese": 92, "math": 88},
{"name": "王五", "gender": "男", "age": 18, "class": "高三二班", "id": "20190103", "chinese": 90, "math": 85},
{"name": "赵六", "gender": "女", "age": 17, "class": "高三二班", "id": "20190104", "chinese": 88, "math": 92},
{"name": "孙七", "gender": "男", "age": 18, "class": "高三三班", "id": "20190105", "chinese": 93, "math": 94},
{"name": "周八", "gender": "女", "age": 17, "class": "高三三班", "id": "20190106", "chinese": 91, "math": 90},
{"name": "吴九", "gender": "男", "age": 18, "class": "高三四班", "id": "20190107", "chinese": 89, "math": 87},
{"name": "郑十", "gender": "女", "age": 17, "class": "高三四班", "id": "20190108", "chinese": 87, "math": 93},
{"name": "冯十一", "gender": "男", "age": 18, "class": "高三五班", "id": "20190109", "chinese": 94, "math": 89},
{"name": "陈十二", "gender": "女", "age": 17, "class": "高三五班", "id": "20190110", "chinese": 90, "math": 91}
]
```
其中,每个元素是一个字典,包含学生的姓名、性别、年龄、班级、学号、语文成绩和数学成绩。可以根据需要修改每个学生的信息。
阅读全文