|
|
发表于 2017-9-30 11:13:59
|
显示全部楼层
- print('welcome using contect book')
- print('1.查询联系人号码')
- print('2.更改联系人信息')
- print('3.删除联系人')
- print('4.退出')
- book=dict(wanglin=18061373966,yangshuyun=13572547035)
- while 1:
- choice=input ('请选择你需要的服务:')
-
- if choice.isdigit():
- choice=int(choice)
-
- if choice ==1:
- answer=input('请输入联系人的姓名:')
- if answer in book:
- print(book[answer])
- else:
- print('没有此联系人')
- if choice ==2:
- answer = input('请输入要更改的联系人姓名:')
- if answer in book:
- print(book[answer])
- r=input('你是否要更改',answer,'的电话号码yes/no?')
- if r == yes:
- s=input ('请输入新号码:')
- book.update(answer=s)
- if choice==3:
- answer = input('请输入你要删除的联系人姓名:')
- if answer in book:
- book.remove(answer)
- else:
- print('你选择的联系人不存在')
- if choice==4:
- print('您已选择退出')
- break
- print("谢谢使用")
复制代码 |
|