python的簡易學生管理系統

2021-09-27 06:49:26 字數 1820 閱讀 3504

python的簡易學生管理系統

以學號為唯一識別符號,因為剛學了字典,老師讓用這個來練一下手,不用函式。

有學號,姓名,和成績。

print("**********==學生管理**********===")

print("1.增加。\n2.查詢。\n3.修改。\n4.刪除。\n5.退出")

print("******************************==")

student= {}

while true:

option=int(input("請輸入運算元字:"))

if option==1:

stu = {}

while true:

id = input("請輸入要新增學生學號:")

if id in student.keys():

print("學號%s已存在!" % id)

continue

else:

stu['id']=id

name = input("請輸入新增學生姓名:")

stu['name'] = name

scores = input("請輸入要新增學生成績:")

stu['scores'] = scores

student[id] = stu

break

elif option == 2:

print("1.查詢單個學生\n2.查詢所有學生")

while true:

num=int(input("請輸入運算元字:"))

if num==1:

id=input("請輸入要查詢學生的學號:")

if id in student.keys():

print("學號:%s,姓名:%s,成績:%s"%(id,student[id]['name'],student[id]['scores']))

else:

print("輸入的學號不存在!請重新輸入!")

break

elif num==2:

for i in student:

print("學號:%s,姓名:%s,成績:%s"%(student[i]['id'],student[i]['name'],student[i]['scores']))

break

elif option == 3:

id=input("請輸入要修改的學生的學號:")

if id not in student.keys():

print("不存在該學號的學生!")

else:

name=input("請輸入要修改的姓名:")

student[id]['name']=name

scores = input("請輸入要修改的成績:")

student[id]['scores'] = scores

elif option == 4:

id=input("請輸入要刪除學生的學號:")

if id in student.keys():

del student[id]

print("學號為%s的學生資訊已經刪除!"%id)

else:

print("不存在該學號的學生!")

elif option==5:

print("謝謝使用!")

break

else:

print("輸入錯誤,請重新輸入")

執行結果:

Python 簡易學生管理系統

students 輸出提示資訊 defshowinfo print 30 print 學生管理系統 簡易版 print 1.新增學生的資訊 print 2.刪除學生的資訊 print 3.修改學生的資訊 print 4.查詢學生的資訊 print 5.遍歷所有學生資訊 print 6.退出系統 pr...

簡易學生管理系統。。。。

簡易學生管理系統這裡使用的是單鏈表,簡單的實現新增姓名,學號,分數,以及刪除,顯示新增的資訊。include include struct node struct node head struct node last void cre list void add node void display ...

python製作簡易學生管理系統

學生資訊管理系統 需求 進入系統,顯示系統功能介面,功能如下 1.增加學員資訊 2.刪除學員資訊 3.修改學員資訊 4.查詢學員資訊 5.顯示所有學員資訊 6.退出系統 系統共6個功能,使用者根據自己需求選取 1.顯示功能介面 定義函式print info,負責顯示系統功能 def print in...