#
FLK-E26550 aqi = round(((aqi_high[i_high] - aqi_low[i_low]) / (c_high[i_high] - c_low[i_low])) * (concentration - c_low[i_low]) + aqi_low[i_low])
51 return aqi
52
53#Function to prompt user for input and calculate PM2.5 and PM10 concentrations and AQI.54def calc_pm():
55 while True:
56 print("\nPlease select the particle type you want to count.:")
42 else:
43 raise ValueError("Invalid pollutant. Choose 'PM2.5' or 'PM10'.")
44
45#Calculate AQI46 i_low = 0
47 while concentration > c_high[i_low]:
48 i_low += 1
27
28#Calculate AQI based on pollutant concentration.
29#concentration: float, concentration value in µg/m³
30#pollutant: string, one of 'PM2.5' or 'PM10'31def calculate_aqi(concentration, pollutant):
32 if pollutant == 'PM2.5':
33 c_low = [0, 12.1, 35.5, 55.5, 150.5, 250.5, 350.5, 500.5]
26 return 'Input concentration is below AQI scale'
27
28#Calculate AQI based on pollutant concentration.
29#concentration: float, concentration value in µg/m³30#pollutant: string, one of 'PM2.5' or 'PM10'
31def calculate_aqi(concentration, pollutant):
32 if pollutant == 'PM2.5':
25 else:
26 return 'Input concentration is below AQI scale'
27
28#Calculate AQI based on pollutant concentration.29#concentration: float, concentration value in µg/m³
30#pollutant: string, one of 'PM2.5' or 'PM10'
31def calculate_aqi(concentration, pollutant):
Block comments should have one space before the pound sign #
and the comment itself.
#Save the data to DB, to ensure redundancy before responding
db.save(req.data)
api.send(req)
# Save the data to DB, to ensure redundancy before responding
db.save(req.data)
api.send(req)