Space Python Loading Python…

API response

Write the codeEasy 2 stages

The launch archive has a web API. Ask it about a launch and it answers with JSON, which Python's json module turns into a dict in one line. The mission planners' dashboard only needs three of its fields.

Read those fields, then look at everything else the response contains.

Print the launch's name, provider and status:

Launch: Lumen-3
Provider: JAXA
Status: Go

Read a value with its key in square brackets: launch["name"]. Inside an f-string, use single quotes for the key: {launch['name']}.

Read the response
Works for any launch

Finish stage 1 to unlock this stage.

Before relying on an API, developers look at a whole response. After the three lines, print every field, indented by two spaces, in the order the response has them:

Launch: Lumen-3
Provider: JAXA
Status: Go
All fields:
  id: b7e3a1c2-5d4f-4e8a-9c1b-2f6d8e0a4b13
  name: Lumen-3
  provider: JAXA
  rocket: H3
  status: Go
  window_start: 2026-11-05T14:30:00Z

launch.items() gives each key with its value: for key, value in launch.items():.

List every field
Works for any response
You're not logged in, so your progress is kept in this browser only. Log in to save it, and to use hints and solutions.

Hints

Creating Dictionaries

creating-dictionaries-python.py
# A dictionary stores pairs: a key, then its value
webb = {
    "name": "James Webb Space Telescope",
    "mirror_metres": 6.5,
    "launched": 2021,
    "instruments": 4,
    "infrared": True,
}
print(webb)

# Square brackets look up a value by its key
print("Mirror width:", webb["mirror_metres"], "metres")

# get() returns a fallback instead of crashing on a missing key
print("Cost:", webb.get("cost", "not recorded"))

# The dict() function builds the same thing from keyword arguments
hubble = dict(name="Hubble", mirror_metres=2.4, launched=1990)
print("Hubble mirror:", hubble["mirror_metres"], "metres")

# Keys do not have to be text. Anything unchangeable works
launch_log = {
    1990: "Hubble",
    2021: "Webb",
    (2027, "planned"): "Roman",
}
print(launch_log[1990])
print("Missions logged:", len(launch_log))
print("Anything launched in 2021?", 2021 in launch_log)
Open the full example
script.py
PythonLn 1, Col 1Spaces: 4
Loading the Python environment…

Separate arguments with commas. They're passed on every Run as sys.argv[1:].