What is the difference between else and elif construct of if statement?

To implement conditions in a program we always use if statement. We can use single if statement or multiple if statement as per our situation.

When we want to implement multiple if statement than we use if…elif…else statement in python. Here ‘eleif’ is short form of ‘else if’ which is used in other languages. We use elif statement to implement condition(s). If the condition for if is False, it checks the condition of the next elif block and so on. else part can be used with ‘if’ or ‘if…elif’ and is only executed when none of the condition(s) is true.

if <condition>:

error: Content is protected !!