老男孩-day1作业二

# coding: gbk
CA_com = {"北京":{"海淀":["百度","搜狐","网易"],"朝阳":["高德","当当","猎聘"],"亦庄":["联通","移动","电信"]},\
"上海":{"黄埔":["阿里","腾讯","携程"],"静安":["大众","巨人","美团"],"虹口":["块钱","滴滴","优步"]},\
"广州":{"越秀":["Aten","Raritan","Avocent"],"白云":["聚美","京东","甲骨文"],"天河":["微软","脸谱","华为"]}}
while 1:
    sum = 1    
    list_tem = {}
    for i in CA_com.keys():
        print("%d : %s" % (sum,i)) 
        list_tem[sum] = i
        sum = sum + 1        
    cs_choose = input("请选择城市(1/2/3):")
    while 1:
        sum1 = 1
        list1_tem = {}
        for j in CA_com[list_tem[int(cs_choose)]].keys():
            print("%d : %s" % (sum1,j))
            list1_tem[sum1] = j
            sum1 = sum1 + 1
        sq_choose = input("请选择地区(1/2/3,4返回):")
        if sq_choose == "4":
            break
        for k in CA_com[list_tem[int(cs_choose)]][list1_tem[int(sq_choose)]]:
            print("--->: " + k)
        ret = input("按任意键返回,回车返回")

字典当中的公司,为随意填写。

posted @ 2016-07-26 17:05  loyfee  阅读(246)  评论(0编辑  收藏  举报