If-Elif-Else Condition in Python | Definition , Syntax and Example program

Definition  of   If-Elif-Else Condition : 

  • In Python, the if-elif-else condition allows  to check multiple conditions and execute different blocks of code depending on which condition is true. 
  • It provides more flexibility than just if-else, as it allows checking multiple conditions in sequence.

if : Executes code if the first condition is true.
elif : Executes code if the previous conditions are false, but this condition is true.
else : Executes code if all the above conditions are false.



Syntax:





Program :




Output :



Post a Comment

0 Comments