美文网首页
通讯录功能简易版

通讯录功能简易版

作者: 焰玉 | 来源:发表于2018-01-08 20:53 被阅读0次
    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'])
    

    相关文章

      网友评论

          本文标题:通讯录功能简易版

          本文链接:https://www.haomeiwen.com/subject/qgkinxtx.html