发布时间:2019-07-14 10:00:28编辑:auto阅读(1638)
源代码如下:
#!/usr/bin/env python
#Filename:addressbook.py
adbook={'alice':100,'bob':101,'chanel':102}
while True:
choice=raw_input("Please input l:list,f:find numuber,e:exit the program: ")
if choice == 'l':
print "The addressbook is %s" % adbook
elif choice == 'f':
name=raw_input("Please input you name: ")
if name in adbook:
phone=adbook[name]
print "the %s phonenum is %s" %(name,phone)
else:
print "Please input the right name"
elif choice == 'e':
break
else:
print "Please input l or f"
说明:此程序耗时一个多小时,但还是不够好,感觉逻辑有点混乱,求指教。
上一篇: 编程语言Python的安装与使用
下一篇: python 多线程特性1
47481
45784
36781
34306
28953
25587
24433
19604
19094
17624
5456°
6039°
5555°
5630°
6556°
5368°
5368°
5874°
5848°
7161°