python實現(xiàn)學生管理系統(tǒng)開發(fā)
使用python完成超級基礎的學生管理系統(tǒng),供大家參考,具體內(nèi)容如下
說明:
1、本學生管理系統(tǒng)非常非常簡易,只有增,顯,查,刪,改功能,對于Python新手容易看懂上手。
2、信息的存儲只使用了字典和列表。
3、不喜勿噴。
代碼:
1、主循環(huán)框架
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.退出系統(tǒng)
*************************
"""
"""姓名、語文成績、數(shù)學成績、英語成績、總分"""
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:
""""程序主循環(huán)"""
print(info_str)
action = input("請輸入想要進行的操作:")
if action == '0':
"""結(jié)束條件"""
print("撒由那拉。")
break
elif action == '1':
print("新建學生信息")
Name = input("請輸入名字:")
Chinese = input("請輸入語文成績:")
Math = input("請輸入數(shù)學成績:")
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("請輸入數(shù)學成績:")
student['English'] = input("請輸入英語成績:")
student['Score'] = int(student['Chinese']) + int(student['Math']) + int(student['English'])
else:
print("{}信息不存在".format(Name))
else:
print("你的輸入有錯誤,請重新輸入。")
總結(jié)
1、代碼框架簡潔明了,添加功能只需要在主循環(huán)中增加即可。
2、超級基礎,不喜勿噴。
關(guān)于管理系統(tǒng)的更多內(nèi)容請點擊《管理系統(tǒng)專題》進行學習
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
- python實現(xiàn)學生管理系統(tǒng)源碼
- 基于python制作簡易版學生信息管理系統(tǒng)
- Python實現(xiàn)學生管理系統(tǒng)的完整代碼(面向?qū)ο?
- 使用python實現(xiàn)學生信息管理系統(tǒng)
- python實現(xiàn)學生信息管理系統(tǒng)源碼
- python實現(xiàn)簡單的學生管理系統(tǒng)
- 利用Python實現(xiàn)學生信息管理系統(tǒng)的完整實例
- 基于Python實現(xiàn)簡單學生管理系統(tǒng)
- 用python實現(xiàn)學生管理系統(tǒng)
- python實現(xiàn)簡單學生信息管理系統(tǒng)
- python學生管理系統(tǒng)的實現(xiàn)
- Python實戰(zhàn)之實現(xiàn)簡易的學生選課系統(tǒng)
相關(guān)文章
在Django中創(chuàng)建URLconf相關(guān)的通用視圖的方法
這篇文章主要介紹了在Django中創(chuàng)建URLconf相關(guān)的通用視圖的方法,Django是Python重多人氣框架中最為著名的一個,需要的朋友可以參考下2015-07-07
Pytest?fixture及conftest相關(guān)詳解
這篇文章主要介紹了Pytest?fixture及conftest相關(guān)詳解,fixture是在測試函數(shù)運行前后,由pytest執(zhí)行的外殼函數(shù),更多相關(guān)內(nèi)容需要的朋友可以參考一下2022-09-09
Python導入Excel表格數(shù)據(jù)并以字典dict格式保存的操作方法
本文介紹基于Python語言,將一個Excel表格文件中的數(shù)據(jù)導入到Python中,并將其通過字典格式來存儲的方法,感興趣的朋友一起看看吧2023-01-01
python調(diào)用攝像頭拍攝數(shù)據(jù)集
這篇文章主要為大家詳細介紹了Python調(diào)用攝像頭拍攝數(shù)據(jù)集,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-06-06
GitHub 熱門:Python 算法大全,Star 超過 2 萬
4 月 27 日,GitHub 趨勢榜第 3 位是一個用 Python 編碼實現(xiàn)的算法庫,Star 數(shù)早已達到 26000+2019-04-04

