Skip to content

Instantly share code, notes, and snippets.

@nfarah86
Created May 18, 2020 06:15
Show Gist options
  • Save nfarah86/a0d1e15319bc117ef55ce35187fb6480 to your computer and use it in GitHub Desktop.
Save nfarah86/a0d1e15319bc117ef55ce35187fb6480 to your computer and use it in GitHub Desktop.
Display the data to the user
def display_data(avg_pm10_data, weather_results):
print("****************************************************\n")
pm10_data = (avg_pm10_data['results'][0]['avg_pm10'])
if pm10_data <= 50:
print("Currently,the air quality is safe")
elif pm10_data > 50 and pm10_data <= 100:
print("Currently,the air quality is safe to the general public. However, people who are sensitive to pollution may experience mild health effects")
elif pm10_data > 100 and pm10_data <= 150:
print("Currently,the air quality is safe to the general public. However, people who are sensitive to pollution may experience more serious health effects")
elif pm10_data > 150 and pm10_data <= 200:
print("Currently,the air quality is unhealthy. The general public may experience mild health effects")
elif pm10_data > 200 and pm10_data <= 300:
print("Currently,the air quality is very unhealthy. The general public may experience mild health effects")
else:
print("Currently,the air quality is hazardous. The general public may experience serious health effects")
print("Right now the average pm10 data is: " + str(avg_pm10_data['results'][0]['avg_pm10'])+"\n")
print("Right now the average weather is: " + str(avg_pm10_data['results'][0]['avg_weather'])+"\n")
print("The current weather is: " + str(weather_results[0]['temp']['value']) + "F")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment