Space Python Loading Python…

Launch commit criteria

Write the codeEasy 2 stages

Minutes before launch, the launch director polls the teams. The launch only goes ahead if every single rule is met: the wind is within limits, there is no lightning nearby, and range safety reports GO. One failed rule means HOLD.

Write the GO/HOLD decision, then make it say which rules are holding the launch.

Clear the launch only if all three rules are met: the wind is under 30 km/h, there is no lightning, and range safety reports GO. With today's reports:

Launch: GO

Join the three conditions with and. lightning is True or False, so not lightning means "no lightning". "Under 30" means 30 itself is too much.

Decide GO or HOLD
Every rule can hold the launch

Finish stage 1 to unlock this stage.

The reports have changed: the wind is up and there is lightning. HOLD on its own doesn't tell the launch director what to wait for. Before the decision, print one line for every rule that fails:

Wind 34 km/h, limit 30 km/h
Lightning in the area
Launch: HOLD

Give each rule its own if, not elif, so that every failing rule is reported, not just the first. When range safety isn't GO, print what it reported: Range safety: NO GO.

Report every failing rule
Right for any reports
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

Logical Operators and, or, not

logical-operators-and-or-not.py
# Logical operators: and, or, not

fuel_percent = 85
crew_ready = True
weather = "clear"

# AND - both conditions must be true
if fuel_percent > 70 and crew_ready:
    print("Fuel and crew: GO")

# OR - at least one must be true
if weather == "clear" or weather == "overcast":
    print("Weather: GO")

# NOT - flips True to False and vice versa
abort_signal = False

if not abort_signal:
    print("No abort signal received")

# Combining all three in a launch decision
if fuel_percent > 70 and crew_ready and not abort_signal:
    print("ALL SYSTEMS GO - clear for launch!")
else:
    print("HOLD - check failed conditions")

# Try changing values above and run again
# What happens with fuel_percent = 50?
# What happens with abort_signal = True?
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:].