Python /
IfStatementsIf statements are a mainstay of programming, allowing you to check pretty much anything with the right conditions. In python, they are written as: if condition: code to execute when condition is true elif condition2: code to execute when condition2 is true else: code to execute when none of the above conditions are true In simple cases when assigning values to a variable depending on the situation, this can all be written in one line:
|