python实现学生管理系统开发

作者:flower10_ 时间:2021-08-26 20:43:17 

使用python完成超级基础的学生管理系统,供大家参考,具体内容如下

说明:

1、本学生管理系统非常非常简易,只有增,显,查,删,改功能,对于Python新手容易看懂上手。
2、信息的存储只使用了字典和列表。
3、不喜勿喷。

代码:

1、主循环框架


while True:

print(info_str)
action = input("请输入想要进行的操作:")

if action == '0':

print("再见。")
 break
elif action == '1':
 print("新建学生信息")

elif action == '2':
 print("显示全部学生")

elif action == '3':
 print("查询学生信息")

elif action == '4':
 print("删除学生信息")

elif action == '5':
 print("修改学生信息")

else:
 print("你的输入有错误,请重新输入。")

2、源代码


info_str = """
*************************
1.新建学生信息
2.显示全部学生
3.查询学生信息
4.删除学生信息
5.修改学生信息
0.退出系统
*************************
"""

"""姓名、语文成绩、数学成绩、英语成绩、总分"""
students = [
{'Name':'张大炮','Chinese':'95','Math':'65','English':'65','Score':'215'},
{'Name':'张益达','Chinese':'65','Math':'95','English':'65','Score':'215'},
{'Name':'Snack','Chinese':'65','Math':'65','English':'95','Score':'215'},
]

while True:
""""程序主循环"""
print(info_str)
action = input("请输入想要进行的操作:")

if action == '0':
 """结束条件"""
 print("撒由那拉。")
 break
elif action == '1':
 print("新建学生信息")
 Name = input("请输入名字:")
 Chinese = input("请输入语文成绩:")
 Math = input("请输入数学成绩:")
 English = input("请输入英语成绩:")
 Score = int(Chinese) + int(Math) + int(English)
 student={
  'Name':Name,
  'Chinese':Chinese,
  'Math':Math,
  'English':English,
  'Score':Score
  }
 students.append(student)
elif action == '2':
 print("显示全部学生")
 for student in students:
  print(student)
elif action == '3':
 print("查询学生信息")
 Name = input('请输入需要查询的名字:')
 for student in students:
  if student['Name'] == Name:
   print(student)
 else:
   print("{}信息不存在".format(Name))
elif action == '4':
 print("删除学生信息")
 Name = input("请输入需要删除的名字:")
 for student in students:
  if student['Name'] == Name:
   students.remove(student)
   break
 else:
  print("{}信息不存在".format(Name))
elif action == '5':
 print("修改学生信息")
 Name = input("请输入需要修改的名字:")
 for student in students:
  if student['Name'] == Name:
   student['Name'] = input("请输入名字:")
   student['Chinese'] = input("请输入语文成绩:")
   student['Math'] = input("请输入数学成绩:")
   student['English'] = input("请输入英语成绩:")
   student['Score'] = int(student['Chinese']) + int(student['Math']) + int(student['English'])
 else:
  print("{}信息不存在".format(Name))
else:
 print("你的输入有错误,请重新输入。")

总结

1、代码框架简洁明了,添加功能只需要在主循环中增加即可。
2、超级基础,不喜勿喷。

关于管理系统的更多内容请点击《管理系统专题》进行学习

来源:https://blog.csdn.net/flower10_/article/details/106954056

标签:python,学生,管理系统
0
投稿

猜你喜欢

  • pytorch-gpu安装的经验与教训

    2022-01-11 20:23:36
  • IE6 bug: 消失的绝对定位元素

    2009-12-04 12:11:00
  • Goland项目使用gomod配置的详细步骤

    2024-04-26 17:35:34
  • 说说回车键触发表单提交的问题

    2009-02-03 13:25:00
  • SQL Server 2012 安装与启动图文教程

    2024-01-27 08:33:35
  • python读写修改Excel之xlrd&xlwt&xlutils

    2022-04-03 16:35:43
  • 总结python中pass的作用

    2021-02-15 18:34:45
  • Python的10道简单测试题(含答案)

    2021-12-28 03:57:24
  • axios发送post请求springMVC接收不到参数的解决方法

    2023-07-02 16:59:05
  • 使用rpclib进行Python网络编程时的注释问题

    2022-12-26 23:44:47
  • 一文详解如何彻底删除旧版本mysql并安装新版本

    2024-01-25 21:17:09
  • Yii2中的场景(scenario)和验证规则(rule)详解

    2024-04-28 09:43:50
  • 使用jupyter notebook运行python和R的步骤

    2023-03-30 18:22:50
  • 前端开发之JS生成32位随机数的方法举例

    2024-04-19 09:56:26
  • Python类中的魔法方法之 __slots__原理解析

    2023-10-01 18:49:51
  • 音频处理 windows10下python三方库librosa安装教程

    2023-10-12 08:29:50
  • Vue 实现穿梭框功能的详细代码

    2024-05-09 10:51:53
  • Django多个app urls配置代码实例

    2021-11-23 10:01:13
  • Mysql字符串截取及获取指定字符串中的数据

    2024-01-24 21:07:46
  • 正则给header的冒号两边参数添加单引号(Python请求用)

    2022-10-07 13:59:59
  • asp之家 网络编程 m.aspxhome.com