PM = 1; while PM!=9999: try: PM = eval(input("请输入PM2.5数值: (输入9999退出)")) if 0<= PM < 35: print("空气优质,快去户外运动!") elif 35 <= PM <75: print("空气良好,适度户外活动!") elif PM==9999: break else: print("空气污染,请小心!") except : print('请输入数字')
PM = 1; while PM!=9999: try: PM = eval(input("请输入PM2.5数值: (输入9999退出)")) if 0<= PM < 35: print("空气优质,快去户外运动!") elif 35 <= PM <75: print("空气良好,适度户外活动!") elif PM==9999: break else: print("空气污染,请小心!") except : print('请输入数字')