In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "Python how to achieve a fully functional student management system". The content is detailed, the steps are clear, and the details are handled properly. I hope that this "Python how to achieve a fully functional student management system" article can help you solve your doubts.
Function description
1. It is divided into two interfaces: (1) login and registration interface (2) student management system interface
two。 The login function is the same as the previously released book management system. After successful login, you can enter the interface of the student management system. It will not be described here.
3. System function (1) add student information (2) delete student information (3) modify student information (4) query student information (5) display all student information (6) exit
4. There are many places to add optimization, but also improved, such as module import, login registration and enter do not modify and other functions. The whole program code is about 200 lines.
Note: the code is divided into two modules and needs to be started in the student_main module. The student_main module is only responsible for the input operation, while the student_tools module is responsible for the specific student information system operation functions. So remember to create two .py files when you copy the code.
The complete code is as follows
Student_main module content code:
Import student_toolsuser= ['wangtaotao'] pwd= [' 123456'] # Login def denglu (): users = input ("Please enter your user name:") pwds = input ("Please enter your password:") if users in user and pwds in pwd: student () else: print ("account or password is incorrect Please re-enter ") # register def zhuce (): users=input (" Please enter the user name you want to register: ") pwds=input (" Please enter the password you want to register: ") user.append (users) pwd.append (pwds) print () print (" registered successfully! ") Print () # login interface def dljiemian (): while True: print ("- -") print ("Student Management system login interface V1.0") print (") print (" 1: login " ") print (" 2: notebook ") print (" 3: exit ") print (") print ("-") Xx=input ("Please enter your choice:") # 1. Log in to if xx=='1': denglu () elif xx=='2': # 2. Register zhuce () elif xx=='3': # 3. Exit print () print ("exit successfully!") Print () break else: print ("input error Please re-enter ") # student management system def student (): while True: # call the interface function student_tools.jiemian () x=input in the student_tools module (" Please enter your choice: ") # add the student if: student_tools.add () # delete the student elif : student_tools.dele () # modify students elif x students: student_tools.xiugai () # query students elif x students 4: student_tools.find () # display all students elif x students: student_tools.showall () # quit the student management system Return to the previous login interface system elif x student management system 6: print () print ("successfully quit the student management system!") Break else: print () print ("input error, please re-enter") print () # call the first login interface function dljiemian ()
Student_tools module content code:
Student_list= [] student_dict= {} # Student Management system Interface def jiemian (): print ("-") print ("Student Management system V1.0") print (") print (" 1: add students ") Print ("2: delete students") print ("3: modify students") print ("4: query students") print ("5: show all students") print ("6: quit the system") print (" ") print ("-") # add student def add (): name=input (" Please enter student name: ") cls=input (" Please enter student class: ") age=input (" Please enter student age: ") phone=input (" Please enter student cell phone number : ") addr=input (" Please enter the student's home address: ") student_dict= {" name ": name "class": cls, "age": age, "phone": phone, "address": addr} student_list.append (student_dict) print () print ("- add student information interface -") print () print ("name\ t", "class\ t\ t", "age\ t\ t", "phone number\ t\ t" "Home address\ t\ t") for student_dict_1 in student_list: print ("% s\ t\ t% s\ t% s"% (student_dict_1 ["name"], student_dict_1 ["class"] Student_dict_1 ["age"], student_dict_1 ["phone"], student_dict_1 ["address"]) print () print ("input successful!") Print () # Delete student def dele (): name_del=input ("Please enter the name of the student you want to delete:") for student_dict_1 in student_list: if name_del in student_dict_1 ["name"]: student_list.remove (student_dict_1) print () print ("% s message deleted successfully!"% name_del) Print () break else: print () print ("you entered the wrong student name Please re-enter ") print () # modify student def xiugai (): name_xiugai=input (" Please enter the name of the student you want to modify: ") for student_dict_1 in student_list: if name_xiugai= = student_dict_1 [" name "]: print () print ("-modify interface-") print () print ("name\ t\ t" "Class\ t\ t", "age\ t\ t", "phone number\ t\ t", "home address\ t\ t") print ("% s\ t\ t% s\ t\ t% s\ t% s"% (student_dict_1 ["name"], student_dict_1 ["class"] Student_dict_1 ["age"], student_dict_1 ["phone"] Student_dict_1 ["address"]) # enter does not modify student_dict_1 ["name"] = new_input (student_dict_1 ["name"], "Please enter the modified student name [enter does not modify]:") student_dict_1 ["class"] = new_input (student_dict_1 ["class"] "Please enter the revised student class [enter no modification]:") student_dict_1 ["age"] = new_input (student_dict_1 ["age"], "enter the modified student age [enter do not modify]:") student_dict_1 ["phone"] = new_input (student_dict_1 ["phone"] "Please enter the modified student mobile phone number [enter does not modify]:") student_dict_1 ["address"] = new_input (student_dict_1 ["address"], "enter the modified student home address [enter does not modify]:") print () print ("modified successfully!") Print () break else: print () print ("you entered the wrong student name Please re-enter ") print () # find student def find (): find_name=input (" Please enter the name of the student you want to find: ") for student_dict_1 in student_list: if find_name= = student_dict_1 [" name "]: print () print ("-query results interface-") Print () print ("name\ t\ t" "Class\ t\ t", "age\ t\ t", "phone number\ t\ t", "home address\ t\ t") print ("% s\ t\ t% s\ t\ t% s\ t% s"% (student_dict_1 ["name"], student_dict_1 ["class"] Student_dict_1 ["age"], student_dict_1 ["phone"] Student_dict_1 ["address"]) else: print () print ("- query results interface -") print () print ("No student information") # displays all student information def showall (): Print () print ("- Show all student information -") print () print ("name\ t\ t" "Class\ t\ t", "age\ t\ t", "phone number\ t\ t", "home address\ t\ t") for student_dict_1 in student_list: print (student_dict_1) print ("% s\ t\ t% s\ t% s"% (student_dict_1 ["name"] Student_dict_1 ["class"], student_dict_1 ["age"], student_dict_1 ["phone"] Student_dict_1 ["address"]) # sets the user to return to the original value without input Input content returns new content def new_input (yuanzhi,message): input_str=input (message) if len (input_str) > 0: return input_str else: return yuanzhi. This article "how to implement a fully functional student management system with Python" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.