Space Python Loading Python…

Upload router

Write the codeEasy 2 stages

Everything the mission uploads to the ground station lands in one inbox: camera images, telemetry files and, now and then, something that doesn't belong there at all. A router script sorts each file into its folder.

Route files by their extension, then make the router cope with the names people and cameras actually produce.

Choose the folder by the file's extension and print where it goes:

.png or .jpg    images
.csv            telemetry
anything else   rejected

For the camera image in the starter code:

cam-1_2026-03-14.png -> images/

Use endswith() for each extension, or to accept two, and store the folder name before printing.

Route the file
Right for every file

Finish stage 1 to unlock this stage.

Real uploads are messier: the new camera writes .JPEG in capitals, names arrive with stray spaces, and the telemetry team also sends .tsv files. The starter code rejects this camera image. Make the router accept .jpeg and .tsv too, in any case, and show the name without the spaces but with its own capitals:

CAM-2_2026-03-14.JPEG -> images/

Keep two versions of the name: one stripped for showing, one stripped and lower-case for checking.

Route the camera image
Right for every file
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

If-elif-else Statement

if-elif-else-statement.py
# Oxygen level on a space station
oxygen = 19.5

if oxygen >= 23:
    status = "Warning: fire risk"
elif oxygen >= 19.5:
    status = "Normal"
elif oxygen >= 16:
    status = "Low"
else:
    status = "Critical"

print(status)

# Signal delay from a deep space probe
delay = 14.0  # minutes

if delay < 1.3:
    location = "Near the Moon"
elif delay < 5:
    location = "Inner solar system"
elif delay < 25:
    location = "Outer planets region"
else:
    location = "Deep space"

print(f"Delay: {delay} min - {location}")
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:].