拿出以前练c的技术搞出来速度飞快……丢人ing……
###############################
#phonebook练习
###############################
conactRecord={"pName":"test" , "pNumber":12345}
def main():
""" main screen for phonebook,just a simple GUI"""
print("\n\n Welcome to phonebook \n")
print("\n**************************************\n")
print("Add new..........................1\n")
print("Show all.........................2\n")
print("Search...........................3\n")
print("Exit.............................0\n")
print("\n**************************************\n")
num = int(input("Num you choise : "))
while(1):
if 1==num:
pbookAddNew()
main()
elif 2==num:
pbookShowAll()
main()
elif 3==num:
pbookSearch()
main()
elif 0==num:
exit()
else:
main()
def pbookAddNew():
"""add info to pbook"""
print("\n_____ADD A NEW_____")
newName = input("Please input new contacter name: ")
newNumber = int(input("Please input new contacter number: "))
print(newName,newNumber)
#conactRecord.add()
def pbookShowAll():
print("show all")
for name,number in conactRecord.items():
print(name,number)
def pbookSearch():
print("pbookSearch")
|
本
作品由
loseblue创作,采用进行许可。
阅读(665) | 评论(0) | 转发(0) |