2.2 KiB
2.2 KiB
Hints
General
- The Python Docs on Control Flow Tools and the Real Python tutorial on conditionals are great places to start.
- The Python Docs on Boolean Operations can be a great refresher on
bools
, as can the Real Python tutorial on booleans. - The Python Docs on Comparisons and comparisons examples can be a great refresher for comparisons.
1. Check for criticality
-
Comparison operators (comparisons) and boolean operations (concept:python/bools) can be combined and used with conditionals.
-
Conditional expressions must evaluate to
True
orFalse
. -
else
can be used for a code block that will execute when all conditional tests returnFalse
.>>> item = 'blue' >>> item_2 = 'green' >>> if len(item) >= 3 and len(item_2) < 5: print('Both pass the test!') elif len(item) >= 3 or len(item_2) < 5: print('One passes the test!') else: print('None pass the test!') ... One passes the test!
2. Determine the Power output range
- Comparison operators can be combined and used with conditionals.
- Any number of
elif
statements can be used as decision "branches". - Each "branch" can have a separate
return
3. Fail Safe Mechanism
- Comparison operators can be combined and used with conditionals.
- Any number of
elif
statements can be used as decision "branches". - Each "branch" can have a separate
return