Learn cities = ['London', 'Birmingham', 'Manchester'] for city in cities: url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric" data = requests.get(url).json

Get a clear, practical understanding of cities = ['London', 'Birmingham', 'Manchester'] for city in cities: url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric" data = requests.get(url).json

Free · starts instantly · no signup required

What you'll cover

  1. 1
    Understand Python Lists
    Learn what a Python list is and how to create one.
  2. 2
    Iterating with For Loops
    Understand how to loop through items in a list.
  3. 3
    Introduction to Web APIs
    Learn what an API is and why it's used.
  4. 4
    Making HTTP Requests
    Understand how to use libraries like 'requests' to fetch data.
  5. 5
    Understanding JSON Data
    Learn how to interpret and use data returned in JSON format.
  6. 6
    Putting It All Together
    Combine lists, loops, API requests, and JSON to get city weather data.

Ready to learn cities = ['London', 'Birmingham', 'Manchester'] for city in cities: url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric" data = requests.get(url).json?

Your adaptive tutor is one tap away. Start now and pick up anytime.