Python student achievement management system simplified version, python
Starting with the student achievement management system, this is the question from the course design of the freshman C language to the Sophomore C ++ course design. Recently, I learned Raspberry Pi, as if Raspberry Pi is commonly used in Python programming, so I learned a wave of Python and read some basic syntaxes to try to write something.
Development Environment: Ubuntu + Python2.7
The Code is as follows:
# Coding = UTF-8 # Save student information studentList = [] def addInfo (name, addr ): tempInfo = {} tempInfo ['name'] = name tempInfo ['addr '] = addr studentList. append (tempInfo) print (studentList) def delInfo (number): if number <len (studentList) and number> = 0: del studentList [number] else: print ("the number you entered is incorrect:") def changeInfon (modifNum, name, addr): if modifNum <len (studentList) and modifNum> = 0: tempInfo = {} tempInfo ['name'] = name tempInfo ['addr '] = addr studentList [modifNum] = tempInfo else: print ("the serial number you entered is incorrect :") def findInfo (findName): I = 0 for info in studentList: if findName = info ['name']: print ("the information you want to search for is % I % s" % (I, info ['name'], info ['addr ']) while True: print ("-" * 30) print ("Enter your options") print ("1. new student information ") print (" 2. delete student information ") print (" 3. modify student information ") print (" 4. query student information ") print ("-"* 30) # Wait for the user input option choose = int (raw_input (" Enter your option: ") if 1 = choose: name = raw_input ("Enter the student's name:") addr = raw_input ("Enter the student's place of origin:") addInfo (name, addr) elif 2 = choose: if 0 = len (studentList): print ("no student information is used in the current system") continue I = 0 for info in studentList: print ("% I % s" % (I, info ['name'], info ['addr ']) I + = 1 number = int (raw_input ("Enter the serial number to be deleted:") delInfo (number) print ("the deleted information is % s" % studentList) elif 3 = choose: I = 0 for info in studentList: print ("% I % s" % (I, info ['name'], info ['addr ']) I + = 1 modifNum = int (raw_input ("Enter the number to be modified:") name = raw_input ("enter the name of the Student: ") addr = raw_input (" Enter the student's place of origin: ") changeInfon (modifNum, name, addr) print (" the modified information is: % s "% studentList [modifNum]) elif 4 = choose: findName = raw_input (" enter the name of the student to search for: ") findInfo (findName) else: print ("You entered an error, please enter it again") continue
For more information, see management system development.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.