学生管理システム-3-回修正

1651 ワード

#       
def printMenu():
	print("="*30)
	print("             V1.0")
	print("1.       :")
	print("2.       :")
	print("3.       :")
	print("4.         :")
	print("5.         :")
	print("0.     :")

#          
#     
newName=""
newSex=""
newPhone=""

def getInfo():
	
	global newName
	global newSex
	global newPhone

  	#3.1          
	newName=input("         :")

	#3.2           
	newSex=input("         :( / )")
	
	#3.3             
	newPhone=input('           :')
#           
def addStuInfo():
	getInfo()
	
	newInfo={}
	newInfo['name']=newName
	newInfo['sex']=newSex
	newInfo['phone']=newPhone
	
	stuInfos.append(newInfo)
#            
def modifyStuInfo():
	#3.1              
	stuId=int(input('           :'))
	
	getInfo()
	
	stuInfos[stuId-1]['name']=newName
	stuInfos[stuId-1]['sex']=newSex
	stuInfos[stuId-1]['phone']=newPhone

#            
stuInfos=[]
def main():
	while True:
		# 1.       
		printMenu()
		
		# 2.        
		key=input('          :')
		
		# 3.        ,       
		if key=="1":
			#       
			addStuInfo()
		elif key=='3':
			#        
			modifyStuInfo()
		elif key == '5':
			print('='*30) 
			print("      :")
			print("="*30)

			print("  	·  	  	    ")
			i=1
			for tempInfo in stuInfos:
				print("%d	%s	%s	%s"%(i,tempInfo['name'],tempInfo['sex'],tempInfo['phone']))
			i+=1
		# 0.    
		if key=="0":
			break

main()