Python student information management system,
This article provides examples to share the code of the python student information management system for your reference. The details are as follows:
# The compiling environment is python3 # the student information management system includes basic information functions, which can be used to input, query, add, and delete student information # basic framework: Start Operation menu, receive input options, call the corresponding function to implement the corresponding function and return to the Start Menu cyclically. # operation menu: student = [] def studentMeau (): print ('-' * 30) print ('------- student information management system -------') print ('1. Add student information') print ('2. Delete student information') print ('3. query student information ') print ('4. Modify student information') print ('5, exit ') print ('-'* 30) def appendStuInf (): studentInf = {'name ': '', 'id':'', 'sex': '', 'age':'', 'project ': ''} studentInf ['name'] = input (' Enter the Student name: ') studentInf ['id'] = input ('Enter the student Id:') studentInf ['sex'] = input ('Enter the Student gender: ') studentInf ['age'] = input ('Enter the student Age:') studentInf ['project'] = input ('Enter the student Major: ') student. append (studentInf) # print (student) def deleteStuInf (): num = input ('Enter the student ID to delete: ') # for I in range (len (student )): # if student [I] ['id'] = num: # student. remove (student [I]) # break for stu_inf in student: if stu_inf ['id'] = Num: student. remove (stu_inf) break # print (student) def inquireStuInf (): flag = False num = input ('Enter the student ID to query: ') for stu_inf in student: if stu_inf ['id'] = num: print ('name: '+ stu_inf ['name'] +' \ n') print ('Id: '+ stu_inf ['id'] +' \ n') print ('sex: '+ stu_inf ['sex'] +' \ n') print ('Age: '+ stu_inf ['age'] +' \ n') print ('Project: '+ stu_inf ['project'] +' \ n ') flag = True break if flag = False: print ('the generated information is not found! ') Def modifyStuInf (): num = input (' enter the student ID to modify: ') flag = False for stu_inf in student: if stu_inf ['id'] = num: print ('name: '+ stu_inf ['name'] +' \ n') print ('Id: '+ stu_inf ['id'] +' \ n') print ('sex: '+ stu_inf ['sex'] +' \ n') print ('Age: '+ stu_inf ['age'] +' \ n') print ('Project: '+ stu_inf ['project'] +' \ n ') flag = True break if flag = False: print ('There is no such information! ') Return print ('1: Name ---- 2: Student ID ---- 3: Gender ---- 4: Age ---- 5: Major ---- 6: Exit' + '\ n') while True: choice = int (input ("Enter Option No.:") if choice = 1: stu_inf ['name'] = input ('enter the Name again :') print ('name corrected to: '+ stu_inf ['name'] +' \ n') elif choice = 2: stu_inf ['id'] = input ('enter your student Id again: ') print ('student Id corrected to:' + stu_inf ['id'] + '\ n ') elif choice = 3: stu_inf ['sex'] = input ('Enter the gender again: ') print ('gender has been corrected: '+ stu_inf ['sex'] +' \ n') elif choic E = 4: stu_inf ['age'] = input ('enter Age again: ') print ('Age corrected: '+ stu_inf ['age'] +' \ n') elif choice = 5: stu_inf ['project'] = input ('enter your major again :') print ('professional corrected to: '+ stu_inf ['project'] +' \ n') elif choice = 6: print ('modified! ') Break else: print (' the input is incorrect and cannot be executed! ') While True: studentMeau () choice = int (input ("Enter the option number:") if choice = 1: # Add student information appendStuInf () elif choice = 2: # Delete student information deleteStuInf () elif choice = 3: # query student information inquireStuInf () elif choice = 4: # modify student information modifyStuInf () elif choice = 5: print ('Thank you! ') Break else: print (' the input is incorrect. Check and try again! ')
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.