首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    Python 编程小案例

    也可以使用 1 行代码描述该通讯录,代码如下: >>> persons = [{'name': '张三', 'address': '南京', 'phone': '12306'}, {'name': '李四...然后获取用户输入的选择 根据用户的选择执行对应的功能 首先打印功能菜单 然后获取用户输入的选择 根据用户的选择执行对应的功能 persons = []while True:     print('1....,persons 记录所有联系人的信息 在第 3 行,创建一个 while 死循环 在第 3 行至第 8 行,打印通讯录功能菜单 在第 9 行,使用 input() 函数获取用户输入的选择 在第 11...的 name 相同,则表示找到指定的 person 在第 5 行,使用方法 persons.remove(person), 从 persons 中删除元素 person 在第 6 行,退出 for 循环...完整的程序 persons = []while True:    print('1. create person')    print('2. list all persons')    print('

    37310
    领券