欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python實(shí)現(xiàn)功能全面的學(xué)生管理系統(tǒng)

 更新時間:2022年05月16日 16:08:26   作者:王濤濤.  
這篇文章主要為大家詳細(xì)介紹了Python實(shí)現(xiàn)功能全面的學(xué)生管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Python實(shí)現(xiàn)學(xué)生管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

功能描述

1.分為兩個界面:(1)登錄和注冊界面 (2)學(xué)生管理系統(tǒng)界面
2.登錄功能和之前發(fā)布的圖書管理系統(tǒng)相同,登錄成功后可進(jìn)入學(xué)生管理系統(tǒng)界面,這里不再敘述
3.系統(tǒng)功能(1)添加學(xué)生信息(2)刪除學(xué)生信息(3)修改學(xué)生信息(4)查詢學(xué)生信息(5)顯示所有學(xué)生信息(6)退出
4.有很多地方增加了優(yōu)化,也進(jìn)行了完善,如模塊導(dǎo)入、登錄注冊以及回車不修改等功能。整個程序代碼大概200行。

注意:代碼分為兩個模塊,需要在student_main模塊中啟動。student_main模塊中只負(fù)責(zé)輸入操作,而student_tools模塊中負(fù)責(zé)具體的學(xué)生信息系統(tǒng)操作實(shí)現(xiàn)功能。所以大家在拷貝代碼的時候記得創(chuàng)建兩個.py文件。

完整代碼如下

student_main模塊內(nèi)容代碼:

import student_tools

user=['wangtaotao']
pwd=['123456']

#登錄
def denglu():
? ? users = input("請輸入您的用戶名:")
? ? pwds = input("請輸入您的密碼:")
? ? if users in user and pwds in pwd:
? ? ? ? student()
? ? else:
? ? ? ? print("賬號或密碼不正確,請重新輸入")

#注冊
def zhuce():
? ? users=input("請輸入您要注冊的用戶名:")
? ? pwds=input("請輸入您要注冊的密碼:")
? ? user.append(users)
? ? pwd.append(pwds)
? ? print()
? ? print("注冊成功!")
? ? print()

#登錄界面
def dljiemian():

? ? while True:
? ? ? ? print("---------------------------")
? ? ? ? print(" ? ?學(xué)生管理系統(tǒng)登陸界面 V1.0 ?")
? ? ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ")
? ? ? ? print(" ? ? ? ?1:登 ? 錄 ? ? ? ? ? ")
? ? ? ? print(" ? ? ? ?2:注 ? 冊 ? ? ? ? ? ")
? ? ? ? print(" ? ? ? ?3:退 ? 出 ? ? ? ? ? ")
? ? ? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ")
? ? ? ? print("---------------------------")
? ? ? ? xx=input("請輸入您的選擇:")
? ? ? ? #1.登錄
? ? ? ? if xx=='1':
? ? ? ? ? ? denglu()
? ? ? ? elif xx=='2':
? ? ? ? #2.注冊
? ? ? ? ? ? zhuce()
? ? ? ? elif xx=='3':
? ? ? ? #3.退出
? ? ? ? ? ? print()
? ? ? ? ? ? print("成功退出!")
? ? ? ? ? ? print()
? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print("輸入錯誤,請重新輸入")
#學(xué)生管理系統(tǒng)
def student():
? ? while True:
? ? ? ? #調(diào)用student_tools模塊中的界面函數(shù)
? ? ? ? student_tools.jiemian()
? ? ? ? x=input("請輸入您的選擇:")
? ? ? ? #添加學(xué)生
? ? ? ? if x=='1':
? ? ? ? ? ? student_tools.add()
? ? ? ? #刪除學(xué)生
? ? ? ? elif x=='2':
? ? ? ? ? ? student_tools.dele()
? ? ? ? #修改學(xué)生
? ? ? ? elif x=='3':
? ? ? ? ? ? student_tools.xiugai()
? ? ? ? #查詢學(xué)生
? ? ? ? elif x=='4':
? ? ? ? ? ? student_tools.find()
? ? ? ? #顯示所有學(xué)生
? ? ? ? elif x=='5':
? ? ? ? ? ? student_tools.showall()
? ? ? ? #退出學(xué)生管理系統(tǒng),返回上一層登錄界面系統(tǒng)
? ? ? ? elif x=='6':
? ? ? ? ? ? print()
? ? ? ? ? ? print("成功退出學(xué)生管理系統(tǒng)!")
? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print()
? ? ? ? ? ? print("輸入錯誤,請重新輸入")
? ? ? ? ? ? print()

#調(diào)用最先執(zhí)行的登錄界面函數(shù)
dljiemian()

student_tools模塊內(nèi)容代碼:

student_list=[]

student_dict={}

#學(xué)生管理系統(tǒng)界面
def jiemian():
? ? print("---------------------------")
? ? print(" ? ? ?學(xué)生管理系統(tǒng) V1.0")
? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ")
? ? print(" ? ? ?1:添加學(xué)生" ? ? ? ? ? ?)
? ? print(" ? ? ?2:刪除學(xué)生" ? ? ? ? ? ?)
? ? print(" ? ? ?3:修改學(xué)生" ? ? ? ? ? ?)
? ? print(" ? ? ?4:查詢學(xué)生" ? ? ? ? ? ?)
? ? print(" ? ? ?5:顯示所有學(xué)生" ? ? ? ? )
? ? print(" ? ? ?6:退出系統(tǒng)" ? ? ? ? ? ?)
? ? print(" ? ? ? ? ? ? ? ? ? ? ? ? ? ")
? ? print("---------------------------")


#添加學(xué)生
def add():
? ? name=input("請輸入錄入學(xué)生姓名:")
? ? cls=input("請輸入學(xué)生班級:")
? ? age=input("請輸入錄入學(xué)生年齡:")
? ? phone=input("請輸入錄入學(xué)生手機(jī)號:")
? ? addr=input("請輸入錄入學(xué)生家庭住址:")

? ? student_dict={"name":name,"class":cls,"age":age,"phone":phone,"address":addr}

? ? student_list.append(student_dict)
? ? print()
? ? print("-----添加學(xué)生信息界面-----")
? ? print()
? ? print("姓名\t\t","班級\t\t","年齡\t\t","電話號\t\t","家庭住址\t\t")
? ? for student_dict_1 in student_list:
? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" %(student_dict_1["name"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["class"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["age"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["phone"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["address"]))
? ? print()
? ? print("錄入成功!")
? ? print()

#刪除學(xué)生
def dele():
? ? name_del=input("請輸入想要刪除的學(xué)生姓名:")
? ? for student_dict_1 in student_list:
? ? ? ? if name_del in student_dict_1["name"]:
? ? ? ? ? ? student_list.remove(student_dict_1)
? ? ? ? ? ? print()
? ? ? ? ? ? print("刪除%s信息成功!" % name_del)
? ? ? ? ? ? print()
? ? ? ? ? ? break
? ? else:
? ? ? ? print()
? ? ? ? print("您輸入的學(xué)生姓名錯誤,請重新輸入")
? ? ? ? print()
#修改學(xué)生
def xiugai():
? ? name_xiugai=input("請輸入想要修改的學(xué)生姓名:")


? ? for student_dict_1 in student_list:

? ? ? ? if name_xiugai == student_dict_1["name"]:
? ? ? ? ? ? print()
? ? ? ? ? ? print("-----修改界面-----")
? ? ? ? ? ? print()
? ? ? ? ? ? print("姓名\t\t", "班級\t\t", "年齡\t\t", "電話號\t\t", "家庭住址\t\t")
? ? ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" %(student_dict_1["name"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["class"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["age"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["phone"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?student_dict_1["address"]))
? ? ? ? ? ? #回車不修改

? ? ? ? ? ? student_dict_1["name"]=new_input(student_dict_1["name"],"請輸入修改后的學(xué)生姓名[回車不修改]:")
? ? ? ? ? ? student_dict_1["class"]=new_input(student_dict_1["class"],"請輸入修改后的學(xué)生班級[回車不修改]:")
? ? ? ? ? ? student_dict_1["age"]=new_input(student_dict_1["age"],"請輸入修改后的學(xué)生年齡[回車不修改]:")
? ? ? ? ? ? student_dict_1["phone"]=new_input(student_dict_1["phone"],"請輸入修改后的學(xué)生手機(jī)號[回車不修改]:")
? ? ? ? ? ? student_dict_1["address"]=new_input(student_dict_1["address"],"請輸入修改后的學(xué)生家庭地址[回車不修改]:")
? ? ? ? ? ? print()
? ? ? ? ? ? print("修改成功!")
? ? ? ? ? ? print()
? ? ? ? ? ? break
? ? else:
? ? ? ? print()
? ? ? ? print("您輸入的學(xué)生姓名錯誤,請重新輸入")
? ? ? ? print()

#查找學(xué)生
def find():
? ? find_name=input("請輸入需要查找的學(xué)生姓名:")
? ? for student_dict_1 in student_list:

? ? ? ? if find_name == student_dict_1["name"]:
? ? ? ? ? ? print()
? ? ? ? ? ? print("-----查詢結(jié)果界面-----")
? ? ? ? ? ? print()
? ? ? ? ? ? print("姓名\t\t", "班級\t\t", "年齡\t\t", "電話號\t\t", "家庭住址\t\t")
? ? ? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" % (student_dict_1["name"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["class"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["age"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["phone"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["address"]))
? ? ? ? else:
? ? ? ? ? ? print()
? ? ? ? ? ? print("-----查詢結(jié)果界面-----")
? ? ? ? ? ? print()
? ? ? ? ? ? print("無此學(xué)生信息")

#顯示所有學(xué)生信息
def showall():
? ? print()
? ? print("-----顯示所有學(xué)生信息-----")
? ? print()
? ? print("姓名\t\t", "班級\t\t", "年齡\t\t", "電話號\t\t", "家庭住址\t\t")
? ? for student_dict_1 in student_list:
? ? ? ? print(student_dict_1)
? ? ? ? print("%s\t\t%s\t\t%s\t\t%s\t\t%s" % (student_dict_1["name"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["class"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["age"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["phone"],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student_dict_1["address"]))
#設(shè)置用戶不輸入內(nèi)容返回原值,輸入內(nèi)容返回新內(nèi)容
def new_input(yuanzhi,message):
? ? input_str=input(message)

? ? if len(input_str)>0:
? ? ? ? return input_str
? ? else:
? ? ? ? return yuanzhi

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論