Using Python Conditional Expressions
DevOps Training Architect II in Content
We need to constantly evaluate a condition of some kind to determine what action to take or what value to assign to a variable we'll use later in our program. In the situation where we only have an
if and an
else, and the body of each branch contains only one expression, then we're able to use a conditional expression. Conditional expressions can be used to succinctly express a simple conditional. In this hands-on lab, we'll be refactoring an existing script by rewriting the simple conditional statements as conditional expressions. The following is a prerequisite for feeling comfortable completing this lab: - Conditional expressions.