Pythondex

Tutorial

Elif Statements in Python

In Python, elif (short for "else if") allows you to check multiple conditions in sequence. Use elif after anif statement to test additional conditions.

Syntax

Example

Explanation

  • The first if checks if score >= 90.
  • If that is False, Python checks the first elif.
  • If none of the if or elif conditions are True, the else block runs.
  • Conditions are checked in order, top to bottom.

Another Example