#!/usr/bin/env python#manage the grade of studentdefinit (date): Date=[[],[],[],[],[]] returnDatedefStore (date): ID=raw_input ('Please your ID:') name=raw_input ('Please your name:') 中文版=raw_input ('Please your 中文版:') Math=raw_input ('Please your math:') Science=raw_input ('Your science:') date[0].append (ID) date[1].append (name) date[2].append (中文版) date[3].append (math) date[4].append (Science)defPrintone (date,key):Print "id:%s,name:%s,english:%s,math:%s,science:%s"% (date[0][key],date[1][key],date[2][key],date[3][key],date[4][key])defPrintbyid (date): number=-1Count=0 Key=raw_input ('Please enter your ID') forIinchDate[0]:ifkey==I:number=I BreakCount+=1ifNumber==-1: Print 'None' Else: Printone (base,count)defprintbyname (date): number=-1Count=0 Countadd=[] Key=raw_input ('Please enter your name') forIinchDate[1]: ifi==Key:number=I Countadd.append (count) Count+=1ifNumber==-1: Print 'None' Else: forJinchCountadd:printone (base,j)defAlterbyid (date): number=-1Count=0 Key=raw_input ('Please enter your ID') forIinchDate[0]:ifkey==I:number=I BreakCount+=1ifNumber==-1: Print 'None' Else: date[1][count]=raw_input ('Please your name:') date[2][count]=raw_input ('Please your 中文版:') date[3][count]=raw_input ('Please your math:') date[4][count]=raw_input ('Your science:')defallprint (date): Count=Len (date[0])ifcount==0:Print'None' Else: forIinchRange (count): Printone (base,i)defDeletebyid (date): number=-1Count=0 Key=raw_input ('Please enter your ID') forIinchDate[0]:ifkey==I:number=I BreakCount+=1ifNumber==-1: Print 'None' Else: Base[0].pop (count) base[1].pop (count) base[2].pop (count) base[3].pop (count) base[4].pop (count) base=[]base=Init (Base)Print" "S:storepd:printbyidpe:printbynameay:alterbyidap:allprintdd:deletebyidother:quit" " whileTrue:choose=raw_input ('Please choose a function:') ifchoose=='s': Store (Base)elifchoose=='PD': Printbyid (Base)elifchoose=='PE': Printbyname (Base)elifchoose=='ay': Alterbyid (Base)elifchoose=='AP': Allprint (Base)elifchoose=='DD': Deletebyid (Base)Else: Break
Python simple student performance management system