Skip to content

Latest commit

 

History

History
13 lines (12 loc) · 774 Bytes

File metadata and controls

13 lines (12 loc) · 774 Bytes

Python-Part-3_Conditional-Expression

Conditional Expression

If

  • if is the program evaluates the test expression and will execute statement(s) only if the test expression is True.

  • If the test expression is False, the statement(s) is not executed.

Else

  • Else statement is to evaluate a condition and take one path if it is true but specify an alternative path if it is not.

Elif

  • Use the elif condition is used to include multiple conditional expressions after the if condition or between the if and else conditions.
  • The elif is short for else if. It allows us to check for multiple expressions.
  • If the condition for if is False, it checks the condition of the next elif block and so on.
  • If all the conditions are False, the body of else is executed.