Space Python Loading Python…

Logical Operators and, or, not

 
0:00 / 0:00

Challenge

Practise what this example shows with these challenges.

Launch commit criteria

Write the codeEasy 2 stages

Clear a launch only if the wind is under 30 km/h, there is no lightning and range safety reports GO, using and and not, then print every rule that is holding the launch.

Start the challenge

Safe mode

Write the codeMedium 2 stages

Put the spacecraft into safe mode when the battery is under 20% or contact has been lost for over 10 minutes, using or, then name the rule that fired with boolean variables and an if/elif chain.

Start the challenge

Flatten nested ifs

Fix the codeMedium 2 stages

Refactor a docking check built from three nested ifs into one condition joined with and, keeping the output exactly the same, then rewrite it as a flat if/elif chain that reports the first check that failed.

Start the challenge

Discussion

Stuck on this example or want to go further? Ask here, or see what others asked.

Log in to ask and reply.

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:].