Names with values
The telemetry decoder hands over each frame as separate lists: the sensor names in one, the readings in another, in matching order. The display needs them back together: each name next to its value.
Pair the lists up, add the units, and make sure the display notices when the lists don't match.
Finish stage 1 to unlock this stage.
Print each sensor with its reading, going through both lists together:
ENG-1: 398.0 ENG-2: 412.5 TANK-1: 78.3 CABIN: 101.2
zip(sensors, readings) gives pairs: the first sensor with the first reading, and so on. Unpack each pair in the loop header.
Finish stage 1 to unlock this stage.
Add the units under the readings, and print each value with its unit:
units = ["C", "C", "%", "kPa"]
ENG-1: 398.0 C ENG-2: 412.5 C TANK-1: 78.3 % CABIN: 101.2 kPa
zip() takes three lists as easily as two. But if one list is shorter, it stops early without a word, and a reading goes missing from the display. Before the loop, check that the three lengths are equal, and if they aren't, print a warning first:
Warning: 4 sensors, 3 readings, 4 units ENG-1: 398.0 C ENG-2: 412.5 C TANK-1: 78.3 %
len(sensors) == len(readings) == len(units) checks all three at once.
Hints
For Loop with enumerate and range
# range() produces a run of numbers so you do not have to type them out
print(list(range(5)))
# One argument: starts at zero, stops before the number you gave
for orbit in range(3):
print("Orbit", orbit, "complete")
# Two arguments: a start and a stop. The stop is never included
for day in range(1, 6):
print("Flight day", day)
# Three arguments: the last one is the step, and it can go backwards
for altitude in range(100, 0, -25):
print(altitude, "km above the surface")
# enumerate() hands you the position and the item at the same time
checklist = ["hatch sealed", "fuel loaded", "guidance online", "range clear"]
for position, task in enumerate(checklist):
print(position, task)
# start=1 numbers things the way a human would
for position, task in enumerate(checklist, start=1):
print(f"Step {position}: {task}")
# Without enumerate you would be counting by hand
count = 0
for task in checklist:
count = count + 1
print("Items checked:", count)
Separate arguments with commas. They're passed on every Run as sys.argv[1:].