Space Python Loading Python…

Wrong line commented out

Fix the codeEasy 2 stages

The pre-flight checklist script prints each check as it runs, and the launch director reads the result before giving the "go". Yesterday a developer was debugging it and left it in a mess: a real check is switched off with a #, and a debug line that should never reach the launch director is switched on.

A # turns the rest of the line into a comment, which Python skips. Programmers use it to switch lines off without deleting them. Put every line back the way it should be.

Run the checklist. Two lines are in the wrong state: the oxygen check doesn't run because it's commented out, and a debug line is printed that the launch director shouldn't see. Switch the oxygen check back on and comment out the debug line, so the checklist prints exactly:

Checking cabin pressure... OK
Checking oxygen supply... OK
Checking fuel valves... OK
Checklist complete

Comment the debug line out with # rather than deleting it: the developer will need it again.

Run the oxygen check
Keep debug output away from the launch director

Finish stage 1 to unlock this stage.

This is the full checklist, and the developer left more behind. Two engine checks were commented out while they tested the script, and a debug line is on again. Some comments have to stay, though: the title, the note explaining why the radio check is off, and the radio check itself, which stays off until the new antenna is fitted.

Switch the two engine checks back on and comment out the debug line. Leave everything else as it is. The output:

Checking cabin pressure... OK
Checking oxygen supply... OK
Checking engine 1 igniter... OK
Checking engine 2 igniter... OK
Checking fuel valves... OK
Checklist complete
Run both engine checks
Leave the radio check off
Keep the comments that explain
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

Comments in Code

comments-in-python-code.py
# This is a single-line comment

"""
This is a multi-line comment.
Useful for longer descriptions.
"""

# Mission parameters
mission_name = "Artemis II"
days_in_space = 10  # approximate duration

print(f"Mission {mission_name}: {days_in_space} days")  # output result
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:].