Space Python Loading Python…

Mission elapsed time

Write the codeMedium 2 stages

Every telemetry frame carries a timestamp like 2026-11-08T18:45:30Z. Mission control wants the mission elapsed time: how long since launch. Counting days and hours by hand across month ends goes wrong eventually, and the ground stations don't even agree on a time zone.

Let the datetime module do the counting.

Parse both timestamps with datetime.fromisoformat() into launched and latest, subtract them into elapsed, and print:

Launched: 2026-11-05 14:30:00+00:00
Mission elapsed time: 3 days, 4:15:30
In hours: 76.3

The middle line is how Python prints a timedelta. For the hours, divide elapsed.total_seconds() by 3600.

Mission elapsed time
Real datetimes

Finish stage 1 to unlock this stage.

Ground stations report events in their own clock's time zone: UTC, Central European Time and French Guiana time. Print each event's time since launch, after the three lines from before:

Orbit insertion: T+0:11:12
Solar array deployed: T+0:32:00
First image: T+3 days, 4:15:30

Parse each timestamp as it is, offset included, and subtract launched.

Time since launch for each event
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

Import System Modules

import-system-modules.py
# A module is a toolbox someone else already built and tested for you

# Plain import brings in the whole module
import sys
import platform
import math

# from ... import brings in just one tool
from math import sqrt

# as gives a module a shorter nickname
import random as rng

# With a plain import: module name, a dot, then the tool
print("Python version:", platform.python_version())
print("Running on:", platform.system())
print("Python lives at:", sys.executable)

# math carries constants you would not want to type from memory
radius_km = 6371
print("Earth circumference:", round(2 * math.pi * radius_km), "km")

# sqrt arrived on its own, so it needs no dot in front
print("Square root of 9:", sqrt(9))

# rng is simply a nickname for random
print("Random sol of the Martian year:", rng.randint(1, 687))
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:].