Code a weather app.
Implement a function that returns the latest forecast for a requested city using a weather API response cache. The function should accept a list of requests, where each request is either a lookup for a city or a refresh event that updates that city’s forecast data. Return the forecast value for each lookup in order.
def weather_app(requests):
requests: a list of requests, each request is a dict with fields:
type: either "lookup" or "refresh"city: a stringforecast: an integer, present only for "refresh""lookup", representing the current cached forecast for that city, or -1 if the city has not been refreshed yet.1 <= len(requests) <= 10^5def weather_app(requests):