Extract Nested Temperature Data from JSON API Response
Beginner Mode

Start your terminal to use beginner mode.

Scenario

A weather API provides forecast data in JSON format with nested temperature information. You need to extract temperature values from the response and save them for analysis.

Task

Write a Python script at /home/interview/extract_temps.py that fetches weather data from the mock API at http://api.weather.local/weather, extracts all temperature values from the nested forecast structure, and saves them as a JSON list to /home/interview/temperatures.json.

Example

Expected output format in /home/interview/temperatures.json:

["12C", "22C", "18C", "10C", ...]

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →