Space Python Loading Python…

File name from data

Write the codeEasy 3 stages

The ground station saves each sensor's readings for the day in a file of its own. The names have to be predictable, so scripts can find them, and safe, so they work on every operating system: lower case, no spaces, the sensor first and then the date.

Build the file names from the data, then a folder path for each sensor.

Build the file name for this sensor's data: the ID in lower case, an underscore, the date and .csv. Then print it:

File: eng-2_2026-03-14.csv

Inside an f-string's braces you can call methods too: {sensor_id.lower()}.

Build the file name
Works for any sensor and date

Finish stage 1 to unlock this stage.

The configuration form gives sensors names like Star Tracker A, and the time of the first reading as a timestamp. Build the same kind of file name from those:

File: star-tracker-a_2026-03-14.csv

Make the name lower case, with dashes instead of spaces, and remove any spaces around it first, since people type those into forms. The date is the first 10 characters of the timestamp.

Build it from the name
Works for any name

Finish stage 2 to unlock this stage.

Each sensor's files go into a folder of their own, named after the sensor, inside telemetry/. Add the full path:

File: star-tracker-a_2026-03-14.csv
Path: telemetry/star-tracker-a/star-tracker-a_2026-03-14.csv

Reuse the slug and the file name you already built.

Add the path
Works for any sensor
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 and Joining Strings

creating-joining-strings.py
# Strings - text in Python
# Creating strings
callsign = "Houston"
astronaut = "Watney"

# Joining strings with +
transmission = callsign + ", this is " + astronaut + "."
print(transmission)

# Repeating strings with *
divider = "=" * 30
print(divider)
print("MISSION LOG - SOL 18")
print(divider)

# Building strings step by step with +=
status = ""
status += "Oxygen OK. "
status += "Water OK. "
status += "Potatoes growing."
print(status)

# String length with len()
mission_id = "ARES-III-MDV-7"
print("ID:", mission_id)
print("Length:", len(mission_id), "characters")
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:].