请帮我用python语言编写一个完整的学生成绩管理系统,学生成绩信息包括:学期、学号、班别、姓名、四门课程成绩(语文、数学、英语和 Python),具体实现以下七个功能: (1)创建信息并以磁盘文件保存; (2)读取磁盘文件并显示输出所有学生的成绩; (3)能按学期、按班级完成对学生成绩的录入、修改; (4)能按班级统计学生的成绩,求学生的总分及平均分; (5)能查询学生成绩,不及格科目及学生名单; (6)能按班级输出学生的成绩单; (7)显示输出 60分以下、60-79、 80-89、90分以上各分数段的学生信息。
时间: 2023-02-09 17:25:29 浏览: 250
学生成绩管理系统
首先,我们需要创建一个类来保存学生成绩信息,包括学期、学号、班别、姓名、四门课程成绩(语文、数学、英语和 Python),并实现计算总分和平均分的功能:
```
class StudentScore:
def __init__(self, term, stu_id, class_id, name, chinese, math, english, python):
self.term = term
self.stu_id = stu_id
self.class_id = class_id
self.name = name
self.chinese = chinese
self.math = math
self.english = english
self.python = python
def total_score(self):
return self.chinese + self.math + self.english + self.python
def avg_score(self):
return self.total_score() / 4
```
然后,我们需要创建一个学生成绩管理类,来实现创建信息并以磁盘文件保存,读取磁盘文件并显示输出所有学生的成绩,按学期、按班级完成对学生成绩的录入、修改,按班级统计学生的成绩,查询学生成绩,按班级输出学生的成绩单,显示输出 60分以下、60-79、 80-89、90分以上各分数段的学生信息。
```
import csv
class StudentScoreManager:
def __init__(self):
self.students = []
def load_from_file(self, file_path):
with open(file_path, "r") as f:
reader = csv.reader(f)
for row in reader:
term, stu_id, class_id, name, chinese, math, english, python = row
chinese, math, english, python = map(int, (chinese, math, english, python))
student = StudentScore(term, stu
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)