Daily mission report
At the end of every day, the outgoing shift leaves a report for the incoming one: each subsystem, its status, its alerts and how much of the day it was up. People read it on a screen in a fixed-width font. The engineering office wants the same numbers as a spreadsheet.
Produce both from the same data.
Finish stage 1 to unlock this stage.
Print the report, WIDTH characters wide: the title and the mission line centred between two rules of =, the column headings, a row per subsystem and a totals line with the alerts added up and the average uptime:
==========================================
DAILY MISSION REPORT
Lumen-3 · 2026-11-05
==========================================
Subsystem Status Alerts Uptime
------------------------------------------
POWER OK 3 99.80%
GNC WARN 2 97.25%
PROP OK 0 100.00%
COMMS DEGRADED 2 94.60%
THERM OK 0 99.95%
------------------------------------------
Total 7 98.32%
The columns are 12, 12, 7 and 11 characters wide: {row['subsystem']:<12} pads on the right, {row['alerts']:>7} on the left, and {value:>10.2f}% gives two decimal places and the sign. "text".center(WIDTH) centres a line.
Finish stage 1 to unlock this stage.
Save the same rows to report.csv with csv.DictWriter: a header row with the four keys, then one row per subsystem. After the report, print an empty line, the saved line, and the file as it was written:
Saved report.csv: subsystem,status,alerts,uptime_pct POWER,OK,3,99.8 GNC,WARN,2,97.25 PROP,OK,0,100.0 COMMS,DEGRADED,2,94.6 THERM,OK,0,99.95
Open the file with newline=""; writeheader() writes the keys and writerows(rows) all the rows. The hidden tests delete the file, run your program again and read what it writes.
Hints
Text Formatting with f-strings
# F-strings - modern text formatting
astronaut = "John Smith"
mission = "Mars Explorer"
days_in_space = 180
print(f"Astronaut: {astronaut}")
print(f"Mission: {mission}")
print(f"Duration: {days_in_space} days")
# We can also do calculations
print(f"That is {days_in_space / 30:.1f} months")
Separate arguments with commas. They're passed on every Run as sys.argv[1:].