Implementation of Student Address Book Management System with python
- 2021-09-11 20:42:46
- OfStack
In this paper, we share the specific code of python to realize the student address book management system for your reference. The specific contents are as follows
Functional module analysis:
1. Home page (menu function)
Step 2 Add students
Step 3 Delete students
STEP 4 Modify students
5. Count the number of contacts in the address book
6. Get all student communication information
The code is as follows:
def main():
while True:
menu()
number = int(input(" Please enter the sequence number of the operation to be implemented: "))
if number==1:
insert() # Add Students
if number==2:
delete() # Delete students
if number==3:
modify() # Modify students
if number==4:
count() # Count the number of contacts in the address book
if number==5:
disply() # Get all student communication information
if number==0:
x=input(" Input yes Exit the system, enter any other characters without exiting :")
if x == "yes":
break
studentlist=[]
def menu():
Menu = """
==================== Student address book management system -V1.0====================
1. Add Students
2. Delete students
3. Modify students
4. Count the number of contacts in the address book
5. Get all student communication information
0. Exit the system
=====================================================
"""
print(Menu)
def insert():
while True:
studentdict={}
studentdict[" Serial number "]=input(" Please enter the serial number of the student to be added: ")
studentdict[" Name "]=input(" Please enter the name of the student to be added: ")
studentdict[" Telephone "]=input(" Please enter the phone number of the student to be added: ")
studentlist.append(studentdict)
x = input(" Input no End adding students, enter any other characters to continue: ")
if x=="no":
break
def delete():
while True:
i=input(" Please enter the serial number of the student to be deleted: ")
for index,item in enumerate(studentlist):
if item[" Serial number "]==i:
del studentlist[index]
x = input(" Input no End the deletion of students. Enter any other characters to continue: ")
if x == "no":
break
def modify():
while True:
i = input(" Please enter the serial number of the student to be modified: ")
for item in studentlist:
if item[" Serial number "]==i:
item[" Name "]=input(" Please enter the name of the modified student: ")
item[" Telephone "]=input(" Please enter the modified student's phone number: ")
x = input(" Input no End the modification of students. Enter any other characters to continue: ")
if x == "no":
break
def count():
a=len(studentlist)
print(" Common address book ",a," Bit contact ")
def disply():
print('---------------------------')
for studentdict_1 in studentlist:
for key,value in studentdict_1.items():
print(key,":",value)
print('---------------------------')
main()