def initInfo():
info = {'Cao':'021-43333333',\
'Kobe':'021-98888888',\
'Harry':'021-3467890'}
return info
def searchInfo(InfoList):
Name = raw_input('Please search the name:')
if Name in InfoList.keys():
print 'The phone number is',InfoList[Name],'\n'
else:
print 'The name isn\'t exsist\n'
def insertInfo(InfoList):
Name = raw_input('Please add the name:')
if Name in InfoList.keys():
print 'The name is exist\n'
else:
Phone = raw_input('Please add the phone number:')
InfoList[Name] = Phone
print '\n'
def deleteInfo(InfoList):
Name = raw_input('Please input the name:')
del InfoList[Name]
print '\n'
def exitSystem():
print 'Thank you for your use\n'
print '|---Welcome To the System---|'
print '|---1: Search for one\'s information ---|'
print '|---2: Insert New information ---|'
print '|---3: Delete one\'s information ---|'
print '|---4: Exit the System ---|'
info = initInfo()
sysCommand = {'1':searchInfo,'2':insertInfo,'3':deleteInfo}
command = raw_input('Please input the command:')
while(command != '4'):
sysCommand[command](info)
command = raw_input('Please input the command:')
exitSystem()