provinces =["山東","四川"]
cities =[["臨沂","濟南","青島"],["重慶"]]# print(cities[0])
op =eval(input("請輸入您要進行的操作,0 表示查詢省對應的城市,1表示查詢城市對應的省"))if op ==0:findp =input("請輸入您要查詢省")if findp in provinces:ind = provinces.index(findp)print(cities[ind])else:print("抱歉,您查詢的省不在列表內")else:f =0findc =input("請輸入您要查詢的城市")l =len(cities)for i inrange(len(cities)):if findc in cities[i]:print(provinces[i])f =1breakif f ==0:print("抱歉,您查詢的城市不在列表內")