diff --git a/学生管理系统/__init__.py b/学生管理系统/__init__.py new file mode 100644 index 0000000..4a91635 --- /dev/null +++ b/学生管理系统/__init__.py @@ -0,0 +1,152 @@ +msg = """******************************** +欢迎使用学生管理系统 +请选择你想要进行的操作 +1.新建学生信息 +2.显示全部信息 +3.查询学生信息 +4.删除学生信息 +5.修改学生信息 + +0.退出系统 +********************************""" +student_info = [ + {"姓名": '张三','语文': 80,'数学': 80,'外语': 80,'总分': 240}, + {"姓名": '李四','语文': 80,'数学': 80,'外语': 80,'总分': 240}, +] + +account = input('请输入您的账号:') +password = input('请输入您的密码:') + +if account == 'guoshenghui' and password == '21412030118': + print('登陆成功,欢迎使用') + print(msg) #输出函数 + while True: #为真死循环 + word = input("请输入想要进行的操作:") + if word == '1': + print("新建学生信息") + name = input('请输入学生姓名:') + chinese = input('请输入语文分数:') + math = input('请输入数学分数:') + english = input('请输入外语分数:') + sum = int(chinese) + int(math) + int(english) + print(sum) + dit = { + '姓名': name, + '语文': chinese, + '数学': math, + '外语': english, + '总分': sum, + } + student_info.append(dit) + + elif word == '2': + + print("显示全部信息") + print('姓名\t\t语文\t\t数学\t\t外语\t\t总分') + for student in student_info: + + print( + student['姓名'] + '\t\t' + + str(student['语文'])+ '\t\t' + + str(student['数学'])+ '\t\t' + + str(student['外语'])+ '\t\t' + + str(student['总分'])+ '\t\t' + ) + + elif word == '3': + print("查询学生信息") + name = input('请输入您想要查询学生的姓名:') + for student in student_info: + if name == student['姓名']: + print('姓名\t\t语文\t\t数学\t\t外语\t\t总分') + print( + student['姓名'] + '\t\t' + + str(student['语文']) + '\t\t' + + str(student['数学']) + '\t\t' + + str(student['外语']) + '\t\t' + + str(student['总分']) + '\t\t' + ) + break + else: + print('没有该学生的信息') + + + elif word == '4': + print("删除学生信息") + name = input('请输入您想要删除学生的姓名:') + for student in student_info: + if name == student['姓名']: + print('姓名\t\t语文\t\t数学\t\t外语\t\t总分') + print( + student['姓名'] + '\t\t' + + str(student['语文']) + '\t\t' + + str(student['数学']) + '\t\t' + + str(student['外语']) + '\t\t' + + str(student['总分']) + '\t\t' + ) + result = input('是否确认删除该学生(y/n):') + if result == 'y': + student_info.remove(student) + elif result == 'n': + continue + break + else: + print('没有该学生信息,请确认信息在删除') + + elif word == '5': + print("修改学生信息") + name = input('请输入您想要修改学生的姓名:') + for student in student_info: + if name == student['姓名']: + print('姓名\t\t语文\t\t数学\t\t外语\t\t总分') + print( + student['姓名'] + '\t\t' + + str(student['语文']) + '\t\t' + + str(student['数学']) + '\t\t' + + str(student['外语']) + '\t\t' + + str(student['总分']) + '\t\t' + ) + result = input('是否确认修改该学生(y/n):') + if result == 'y': + name = input('请输入学生姓名:') + chinese = input('请输入语文分数:') + math = input('请输入数学分数:') + english = input('请输入外语分数:') + sum = int(chinese) + int(math) + int(english) + print(sum) + student['姓名'] = name + student['语文'] = chinese + student['数学'] = math + student['外语'] = english + student['总分'] = sum + elif result == 'n': + continue + break + + else: + print('未找到该学生信息,请先确认该学生是否存在再进行修改') + + elif word == '0': + print("退出系统,欢迎下次使用") + break +elif account == 'xs' and password == '12345': + while True: + name = input('请输入您想要查询学生的姓名(输入0退出)') + if name == '0': + break + for student in student_info: + if name == student['姓名']: + print('姓名\t\t语文\t\t数学\t\t外语\t\t总分') + print( + student['姓名'] + '\t\t' + + str(student['语文']) + '\t\t' + + str(student['数学']) + '\t\t' + + str(student['外语']) + '\t\t' + + str(student['总分']) + '\t\t' + ) + break + else: + print('没有该学生的信息') + +else: + print('账号或者密码输入错误') \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/.idea/inspectionProfiles/profiles_settings.xml b/计科2101郭圣辉21412030118/pythonProject3/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/.idea/misc.xml b/计科2101郭圣辉21412030118/pythonProject3/.idea/misc.xml deleted file mode 100644 index 2a08db1..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/.idea/modules.xml b/计科2101郭圣辉21412030118/pythonProject3/.idea/modules.xml deleted file mode 100644 index 1fb3c8b..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/.idea/pythonProject3.iml b/计科2101郭圣辉21412030118/pythonProject3/.idea/pythonProject3.iml deleted file mode 100644 index 2c80e12..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/.idea/pythonProject3.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/.idea/workspace.xml b/计科2101郭圣辉21412030118/pythonProject3/.idea/workspace.xml deleted file mode 100644 index 52c5881..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/.idea/workspace.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 1716777043418 - - - - \ No newline at end of file diff --git a/计科2101郭圣辉21412030118/pythonProject3/学生管理系统/__init__.py b/计科2101郭圣辉21412030118/pythonProject3/学生管理系统/__init__.py deleted file mode 100644 index bed0b4e..0000000 --- a/计科2101郭圣辉21412030118/pythonProject3/学生管理系统/__init__.py +++ /dev/null @@ -1,74 +0,0 @@ -class_info =[] -def print_menu(): - print("---------------") - print("学生管理系统") - print("1:添加学生") - print("2:删除学生") - print("3:修改学生") - print("4:查询学生") - print("5:显示所有学生") - print("6:退出系统") - print("---------------") -def add_student(): - print("添加学生的功能") - global class_info - name = input("输入学生的姓名") - age = input("输入学生的年龄") - score = input("输入学生的分数") - - # 【姓名年龄分数输入】 - for student in class_info: - if class_info["name"] == name: - print("学生姓名重复") - return - student = { - "name": name, - "age": age, - "score": score - } - - class_info.append(student) - print("添加学生信息成功") - print(class_info) - - -def del_student(): - print("删除学生信息") - global class_info - name = input("请输入删除学生的姓名") - for student in class_info: - if student["name"] == name: - class_info.remove(student) - print("删除学生信息成功") - return - print("不存在该学生信息") - -def modify_student(): - global class_info - name = input("") - for student in class_info: - if student["name"] == name: - student["name"] = input("请输入修改后的学生姓名:") - # jx = input("是否继续修改") - # if jx == "y" or jx == "yes": - student["age"] = input("请输入修改后的学生年龄:") - student["score"] = input("请输入修该后的学生分数:") - print("修改学生信息成功") - return - print("输入的学生信息不存在") -def main(): #主要逻辑 - while True: - print_menu() - choose = int(input("请输入")) - - if choose == 1: - add_student() - elif choose == 2: - del_student() - elif choose == 3: - modify_student() - elif choose == 4: - pass - -if __name__ == '__main__' : - main() \ No newline at end of file