Numbered checklist
Before every flight the crew works through the pre-flight checklist, item by item, and calls out each number as they go. The checklist is stored as a list, and the screen in the cockpit shows it numbered, starting from 1.
Print the numbered checklist, then show which items are already done.
Finish stage 1 to unlock this stage.
Print the checklist numbered from 1, one item per line:
1. Seal the hatch 2. Check cabin pressure 3. Arm the abort system 4. Switch to internal power 5. Get a go from Mission Control
enumerate(checklist, start=1) gives pairs of a number and an item. Unpack them in the loop: for number, item in enumerate(checklist, start=1):.
Finish stage 1 to unlock this stage.
The crew has done the first two items. Add completed = 2 under the list, then show done items with [x] and the rest with [ ]:
[x] 1. Seal the hatch [x] 2. Check cabin pressure [ ] 3. Arm the abort system [ ] 4. Switch to internal power [ ] 5. Get a go from Mission Control
Inside the loop, compare number with completed to choose the box.
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:].