如何用python的dictionary编写一个联系人通讯录程序

##请问如何用python的dictionary写一个联系人通讯录程序,具体要求以及输出示例如下:

img


maillistdic = {}
while True:
    name = input("Enter the name of the contact ")
    if name not in maillistdic.keys():
        mark = input('The name is new. Do you want to add the contact? y/n ')
        if mark.upper() == 'Y':
            phonenumber = input('Enter the telephone number ')
            maillistdic[name] = phonenumber
            print('The contact has been added ')
    else:
        print('The contact is already in your list')
        print("The telephone number is", maillistdic[name])
    print('The following is your contact list ')
    for k, v in maillistdic.items():
        print(k, v)
    mark=input('Do you want to process another transaction? y/n ')
    if mark.upper()!='Y':
        break

有帮助请采纳,有问题继续交流,你的采纳是对我回答的最大的肯定和动力

img

考察的是input
和输出print
对着需求来做即可。

如果有疑问,来交流