Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Hourly Temperature Extractor | Advanced API Usage and Data Processing
Quizzes & Challenges
Quizzes
Challenges
/
Working with APIs in Python

bookChallenge: Hourly Temperature Extractor

In this challenge, you will deepen your skills in working with real-world APIs by retrieving and processing hourly temperature data for a specific location. You will use the Open-Meteo API to fetch temperature readings for Paris, France (latitude: 48.85, longitude: 2.35). The goal is to extract the hourly temperatures from the API's JSON response and print the first five values. This task will test your ability to make HTTP requests, parse JSON data, and access specific values within the data structure.

Opgave

Swipe to start coding

Write a function that retrieves hourly temperature data for Paris from the Open-Meteo API and prints the first five temperature values from the response.

  • The function must make an HTTP GET request to the Open-Meteo API endpoint with latitude 48.85 and longitude 2.35, requesting hourly temperature data.
  • The function must extract the list of temperature values from the JSON response.
  • The function must print the first five temperature values from this list.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 3
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

What is the URL for the Open-Meteo API to get hourly temperature data for Paris?

Can you show me how to extract the hourly temperatures from the JSON response?

How do I print only the first five temperature values from the data?

close

bookChallenge: Hourly Temperature Extractor

Stryg for at vise menuen

In this challenge, you will deepen your skills in working with real-world APIs by retrieving and processing hourly temperature data for a specific location. You will use the Open-Meteo API to fetch temperature readings for Paris, France (latitude: 48.85, longitude: 2.35). The goal is to extract the hourly temperatures from the API's JSON response and print the first five values. This task will test your ability to make HTTP requests, parse JSON data, and access specific values within the data structure.

Opgave

Swipe to start coding

Write a function that retrieves hourly temperature data for Paris from the Open-Meteo API and prints the first five temperature values from the response.

  • The function must make an HTTP GET request to the Open-Meteo API endpoint with latitude 48.85 and longitude 2.35, requesting hourly temperature data.
  • The function must extract the list of temperature values from the JSON response.
  • The function must print the first five temperature values from this list.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 3
single

single

some-alt