code
# Storing student information student = list() # Show menu def showMenu(): print("1. Increase student information ") print(
"2. Delete student information ") print("3. Modify student information ") print("4. Display student information ") print("0. Exit the system ") select = eval(
input(" operation :")) return select # Add student information def addStudent(): print("----- Increase student information -----")
name= input(" full name :") sex = input(" Gender :") age = input(" Age :") phone = input(" Telephone :")
student.append({"name":name,"sex":sex,"age":age,"phone":phone}) print(" Added successfully !")
# Display student information def showStudent(): if len(student) == 0: print(" Current student information is empty !") else: print(
"----------- Student information ------------") print(" Serial number \t full name \t Gender \t Age \t Telephone ") for i in range(0,len(
student)): print("%d\t%s\t%s\t%s\t%s"%(i+1,student[i].get('name'),student[i].get
('sex'),student[i].get('age'),student[i].get('phone'))) print(
"------------------------------") # Delete student information def delStudent(): print(
"--- Deletion in progress ---") print("----- Current student information ------") showStudent() select = eval(input(
" Please enter the student serial number to delete :")) del student[select-1] print(" Deletion succeeded !") # Modify student information def reviseStudent(
): studict = {1: "name", 2: "sex", 3: "age", 4: "phone"} print(
"----- Modification in progress -----") showStudent() num = eval(input(" Please input the student serial number to be modified :")) print(
"1- Change name \n2- Modify gender \n3- Modify age \n4- Modify phone number ") revisenum = eval(input(" Please enter the serial number of the information to be modified :")) newstr
= input(" Please enter new information :") student[num-1][studict[revisenum]] = newstr print(" Modification succeeded !")
# Main running functions def init(): while True: # Display student information showStudent() # Show menu select = showMenu()
if select == 1: addStudent() elif select == 2: delStudent() elif select == 3:
reviseStudent() elif select == 4: showStudent() elif select == 0: # Exit the system break
else: print(" Input error ! Please operate again !") continue init()
Operation results

* Increase student information

2. Delete student information

3. Modify student information

4. Display student information

Technology