48Grabbing the Weather

Is it nice out today? Or should I grab my coat?

Using the OpenWeatherMap API at http://openweathermap.org/current, create a program that prompts for a city name and returns the current temperature for the city.

Example Output

 
Where are you? Chicago IL
 
Chicago weather:
 
65 degrees Fahrenheit

Constraint

  • Keep the processing of the weather feed separate from the part of your program that displays the results.

Challenges

  • The API gives the sunrise and sunset times, as well as the humidity and a description of the weather. Display that data in a meaningful way.

  • The API gives the wind direction in degrees. Convert it to words such as “North,” “West,” “South,” “Southwest,” or even “South-southwest.”

  • Develop a scheme that lets the ...

Get Exercises for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.