Space Python Loading Python…

Accept the right files

Write the codeEasy 2 stages

The upload tool sends telemetry files to the mission archive, but only CSV files from the telemetry/ folder belong there. Last week someone uploaded a photo and a backup file, and the archive's import broke for a day.

Check every path before it's accepted, then make the checks work for paths typed on a Windows PC.

Print whether the path starts with telemetry/ and whether it ends with .csv:

In telemetry/: True
CSV file: True

path.startswith("telemetry/") and path.endswith(".csv") each give True or False. Use them rather than in: ".csv" in path would also be true for old.csv.bak.

Check the folder and the type
Isn't fooled

Finish stage 1 to unlock this stage.

This path was typed on a ground station PC: Windows backslashes, capitals and spaces around it. The starter code says False twice, although it's exactly the right file. Clean the path first, then check the clean version:

In telemetry/: True
CSV file: True

Remove the spaces, turn backslashes into forward slashes and make it lower case. Inside quotes, a single backslash is written as "\\".

Accept the messy path
Works for any path
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

String Methods - upper, lower, strip

string-methods-upper-lower.py
# String methods - cleaning and checking text
# Imagine a noisy transmission coming in from a deep space probe
raw_signal = "   voyager 1: still alive   "

# .strip() removes whitespace from both ends
clean = raw_signal.strip()
print("Cleaned:", clean)

# .upper() and .lower() change case
print("Shouted:", clean.upper())
print("Whispered:", clean.lower())

# .title() capitalizes each word - useful for names and headers
print("Headline:", clean.title())

# Checking how a string starts or ends
mission_id = "ARTEMIS-II-2026"
print("Is Artemis?", mission_id.startswith("ARTEMIS"))
print("From 2026?", mission_id.endswith("2026"))

# Replacing parts of a string
log_entry = "Engine status: nominal"
print("Updated:", log_entry.replace("nominal", "OPTIMAL"))
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:].