資源簡介
簡單的python實現一個管理系統
代碼片段和文件信息
def?showInfo():??
????print(“-“*30)??
????print(“?????學生管理系統??v1.0“)??
????print(“?1.添加學生的信息“)??
????print(“?2.刪除學生的信息“)??
????print(“?3.修改學生的信息“)??
????print(“?4.查詢學生的信息“)??
????print(“?5.遍歷所有學生的信息“)??
????print(“?6.退出系統“)??
????print(?‘-‘*30)??
??
#定義一個列表,用來存儲多個學生的信息??
students=[]??
??
??
while?True:??
????#把功能列表進行顯示給用戶??
????showInfo()??
??
????#提示用戶選擇功能??
????#獲取用戶選擇的功能??
????key?=?int(input(“請選擇功能(序號):“))??
??
????#根據用戶選擇,完成相應功能??
????if?key?==?1:??
????????print(“您選擇了添加學生信息功能“)??
????????name?=?input(“請輸入學生姓名:“)??
????????stuId?=?input(“請輸入學生學號(學號不可重復):“)??
????????age?=?input(“請輸入學生年齡:“)??
??
????????#驗證學號是否唯一??
????????i?=?0??
????????leap?=?0??
????????for?temp?in?students:??
????????????if?temp[‘id‘]?==?stuId:??
????????????????leap?=?1??
?????
評論
共有 條評論