标签:浙江省 江苏省 was usr not int coding 作业2 杭州
#!/usr/local/bin/python3 # -*- coding:utf-8 -*- province={ ‘江苏省‘:{ ‘南京市‘:[‘秦淮区‘,‘玄武区‘,‘栖霞区‘], ‘苏州市‘:[‘姑苏区‘,‘虎丘区‘,‘吴中区‘], ‘无锡市‘:[‘滨湖区‘,‘惠山区‘,‘锡山区‘] }, ‘浙江省‘:{ ‘杭州市‘:[‘西湖区‘,‘拱墅区‘,‘萧山区‘], ‘温州市‘:[‘鹿城区‘,‘瓯海区‘,‘龙湾区‘], ‘宁波市‘:[‘镇海区‘,‘海曙区‘,‘江北区‘] } } while True: print("hello,which province do you want to choose?") for i in province: print(i) province_choose=input("-->") while True: if province_choose in province.keys(): print("which city do you want to choose?") for j in province[province_choose]: print(j) city_choose=input("-->") while True: if city_choose in province[province_choose].keys(): print("here are the areas:") for k in province[province_choose][city_choose]: print(k) area_choose=input("-->") while True: if area_choose in province[province_choose][city_choose]: print("there is nothing to show...") break elif area_choose==‘q‘: exit() elif area_choose==‘r‘: break else: print("your choice was unexist!") break elif city_choose==‘r‘: break elif city_choose==‘q‘: exit() else: print("your choice was unexist!") break if area_choose==‘r‘: break elif province_choose==‘q‘ or province_choose==‘r‘: exit() else: print("your choice was unexist!") break if city_choose==‘r‘: break
标签:浙江省 江苏省 was usr not int coding 作业2 杭州
原文地址:https://www.cnblogs.com/octopuszy/p/8994673.html