通讯录功能简易版

students1 = {'name':'Bob','phone_number':'13823783145','address':'江西省九江市共青城'}
students2 = {'name':'Jack','phone_number':'15079201256','address':'江西省南昌市新建县'}
students3 = {'name':'Mike','phone_number':'18963256820','address':'广东省深圳市龙岗区'}
students4 = {'name':'','phone_number':'','address':''}
n = [students1,students2,students3]

name1 = input('请输入你需要新增的学生姓名:')
n.insert(3,students4)
students4['name'] = name1



phone_number1 = input('请输入需新增学生的手机号码:')
students4['phone_number'] = phone_number1




address1 = input('请输入需新增学生的住址:')
students4['address'] = address1



print(n[3]['name']+'的手机号码是:'+ n[3]['phone_number']+','+'住址是:'+ n[3]['address'])


name = input('请输入学生姓名:')
for x in n:
    if x['name'] == name:
        print(x['name']+'的手机号码是:'+ x['phone_number']+','+'住址是:'+ x['address'])

你可能感兴趣的:(通讯录功能简易版)