You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# incoming data is a utf-8 string, encode it as a json object
97
97
forecast=json.loads(forecast_data)
98
+
99
+
# Print out the forecast
98
100
try:
99
-
print('It is {0} and of {1}F.'.format(forecast['summary'], forecast['temperature']))
101
+
print('It is {0} and {1}F.'.format(forecast['summary'], forecast['temperature']))
100
102
exceptKeyError:
101
103
# future weather forecasts return a high and low temperature, instead of 'temperature'
102
104
print('It will be {0} with a high of {1}F and a low of {2}F.'.format(forecast['summary'], forecast['temperatureLow'], forecast['temperatureHigh']))
103
-
print('with a humidity of {0}% and a wind speed of {1}mph.'.format(forecast['humidity'], forecast['windSpeed']))
104
-
print('There is a {0}% chance of precipitation.'.format(forecast['precipProbability']))
105
+
print('with a humidity of {0}%, a wind speed of {1}mph, and a {2}% chance of precipitation.'.format(forecast['humidity'], forecast['windSpeed'], forecast['precipProbability']))
0 commit comments