Implementation of python student management system

The examples in this article share the specific code of the python student management system for your reference. The specific content is as follows

``` name_list =[] # Store student information dictionary, store student information in dictionary, then use list to store dictionary
# menu
def display_menu():print("-"*30)print(" Student Management System v8.8")print("1. Add student information")print("2. Delete student information")print("3. Modify Student information")print("4. Query individual student information")print("5. Query all student information")print("6. Exit the system")print("-"*30)
# Selection of the serial number
def get_choice():
selected_key =input("Please enter the selected serial number:")return selected_key
# Check if gender is legal
def check_sex(new_sex):
flag = True
while flag: if new_sex =='male' or new_sex =='female':
flag = False
else:
new_sex =input("The input gender is wrong, please re-enter (male/female):") return new_sex
# Check if the phone number is legal
def check_phone(new_phone):
flag = True
while flag:if new_phone.isdigit():
flag = False
else:
new_phone =input("The phone number you entered is wrong, please re-enter:")return new_phone
# Check if the student ID is duplicated or incorrect
def check_id(new_id):
flag = True
while flag:
# Check if it is a pure number before considering whether it is a duplicate. If it is not a pure number, pass directly
if new_id.isdigit():for i inrange(len(name_list)):if name_list[i]['id']== new_id:
new_id =check_id(input("The student ID you entered is duplicate, please re-enter:"))
flag = False
else:
new_id =input("The student ID you entered is wrong, please re-enter:")return new_id
# Add student information
def add_name():
new_info ={}
new_id =check_id(input("Please enter student ID:"))
new_info['id']= new_id
new_name =input("Please enter your name:")
new_info['name']= new_name
new_sex =check_sex(input("Please enter gender (male/female):"))
new_info['sex']= new_sex
new_phone =check_phone(input("Please enter the phone number:"))
new_info['phone']= new_phone
name_list.append(new_info)print("Added successfully!")
# Query all student information
def find_all():print("="*30)for name in name_list:print(name['id'], name['name'], name['sex'], name['phone'])print("="*30)
# Delete student information
def del_name():
del_id_is =input("Please enter the student ID to be deleted:")
flag = False
index =0for i inrange(len(name_list)):if name_list[i]['id']== del_id_is:
flag = True
index = i
breakif flag:
name_list.pop(index)print("Delete successfully!")else:print("Student not found! Please check if the student ID is entered correctly!")
# Name modification detail function
def choice_of_name(index):while True:
choice =input("Please enter the student's (1.id 2. Name 3. Gender 4. Telephone number, 5. All changes):") if choice =='5':
new_id =input("Please enter a new student ID:")
name_list[index]['id']= new_id
new_name =input("Please enter a new name:")
name_list[index]['name']= new_name
new_sex =check_sex(input("Please enter gender (male/female):"))
name_list[index]['sex']= new_sex
new_phone =check_phone(input("Please enter the phone number:"))
name_list[index]['phone']= new_phone
break
elif choice =='1':
new_id =input("Please enter a new student ID:")
name_list[index]['id']= new_id
break
elif choice =='2':
new_name =input("Please enter a new name:")
name_list[index]['name']= new_name
break
elif choice =='3':
new_sex =check_sex(input("Please enter gender (male/female):"))
name_list[index]['sex']= new_sex
break
elif choice =='4':
new_phone =check_phone(input("Please enter the phone number:"))
name_list[index]['phone']= new_phone
breakelse:print("The input is wrong, please re-enter!")
# Modify student information
def re_name():
id_is =input("Please enter the student ID to be modified:")
flag = False
index =0
# First find the subscript of the student to be modified
for i inrange(len(name_list)):if name_list[i]['id']== id_is:
flag = True
index = i
breakif flag:choice_of_name(index)print("Modification succeeded!")else:print("Modification failed, student information was not found!")
# Query individual student information
def find_name():
find_id_is =input("Please enter the student ID to be queried:")
flag = False
index =0for i inrange(len(name_list)):if name_list[i]['id']== find_id_is:
flag = True
index = i
breakif flag:print("Student inquired, student information is:")print(name_list[index]['id'], name_list[index]['name'], name_list[index]['sex'], name_list[ index]['phone'])else:print("Student not found!")
def main():
exit_name = True
while exit_name:display_menu()
key =get_choice()if key =='1':add_name()
elif key =='2':del_name()
elif key =='3':re_name()
elif key =='4':find_name()
elif key =='5':find_all()
elif key =='6':
exit_name = False
else:print("Please enter the correct value!")main()

For more learning materials, please pay attention to the topic "Management System Development".

The above is the whole content of this article, I hope it will be helpful to everyone's study.

Recommended Posts

Implementation of python student management system
Python realizes the development of student management system
Implementation of business card management system with python
Implementation of business card management system based on python
Python implementation of gomoku program
Detailed implementation of Python plug-in mechanism
Implementation of reverse traversal of python list
Python implementation of IOU calculation case
Python implements student performance evaluation system
Python realizes business card management system
Python preliminary implementation of word2vec operation
Implementation of python selenium operation cookie
Python business card management system development
Implementation of python3 registration global hotkey
Python version business card management system
Implementation of python gradient descent algorithm
Basic analysis of Python turtle library implementation
Python implementation of intersection and IOU tutorial
Implementation principle of dynamic binding of Python classes
7 features of Python3.9
centos system management
Python implements a simple business card management system
Use python to realize business card management system
Implementation of Python headless crawler to download files
Python implementation of AI automatic matting example analysis
Python implementation of hand drawing effect example sharing
Python writes the game implementation of fishing master
Detailed explanation of the implementation steps of Python interface development
Basics of Python syntax
Basic syntax of Python
Basic knowledge of Python (1)
Context management in Python
Prettytable module of python
09. Common modules of Python3
Python crawler gerapy crawler management
Centos system process management
Consolidate the foundation of Python (4)
Consolidate the foundation of Python(7)
In-depth understanding of python list (LIST)
Subscripts of tuples in Python
Python analysis of wav files
Python runtime exception management solution
Consolidate the foundation of Python(6)
Python drawing rose implementation code
Analysis of JS of Python crawler
python king of glory wallpaper
Consolidate the foundation of Python(5)
Python realizes face sign-in system
Analysis of Python Sandbox Escape
Some new features of Python 3.10
Deep understanding of Python multithreading
Analysis of Python object-oriented programming
Implementation of CentOS8.0 Network Configuration
Python version of OpenCV installation
Python GUI simulation implementation calculator
9 feature engineering techniques of Python
matplotlib of python drawing module
Python method of parameter passing
Consolidate the foundation of Python (3)
Collection of Python Common Modules