#!/usr/bin/env python#manage the grade of student
definit(date):
date=[[],[],[],[],[]]returndatedefstore(date):
ID=raw_input("Please your ID:")
name=raw_input("Please your name:")
english=raw_input("Please your english:")
math=raw_input("Please your math:")
science=raw_input("Please your science:")
date[0].append(ID)
date[1].append(name)
date[2].append(english)
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")for i indate[0]:if key==i:
number=ibreakcount+=1
if number==-1:print "None"
else:
printone(base,count)defprintbyname(date):
number=-1count=0
countadd=[]
key=raw_input("Please enter your name")for i in date[1]:if i==key:
number=i
countadd.append(count)
count+=1
if number==-1:print "None"
else:for j incountadd:
printone(base,j)defalterbyid(date):
number=-1count=0
key=raw_input("Please enter your ID")for i indate[0]:if key==i:
number=ibreakcount+=1
if number==-1:print "None"
else:
date[1][count]=raw_input("Please your name:")
date[2][count]=raw_input("Please your english:")
date[3][count]=raw_input("Please your math:")
date[4][count]=raw_input("Please your science:")defallprint(date):
count=len(date[0])if count==0:print"None"
else:for i inrange(count):
printone(base,i)defdeletebyid(date):
number=-1count=0
key=raw_input("Please enter your ID")for i indate[0]:if key==i:
number=ibreakcount+=1
if number==-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:store
pd:printbyid
pe:printbyname
ay:alterbyid
ap:allprint
dd:deletebyid
other:quit"""
whileTrue:
choose=raw_input("Please choose a function:")if choose=="s":
store(base)elif choose=="pd":
printbyid(base)elif choose=="pe":
printbyname(base)elif choose=="ay":
alterbyid(base)elif choose=="ap":
allprint(base)elif choose=="dd":
deletebyid(base)else:break