Python 语言中没有 switch 语句,但可以通过多个if 语句实现,
或者使用字典的方法映射实现类似开关语句的功能。
car_price ={"微型车":"3~31万","小型车":"3~41万","紧凑型车":"4~55万","中型车":"6万以上","大型车":"18万以上","大型车":"81万以上"}
car_input=input("输入要查询的车型:").strip("")
sch_price=car_price.get(car_input,"nothing")
if sch_price != "nothing" :
print(sch_price)
else:
print("车型不存在!")