Skip to Content
This forum is now read-only. Please use our new forums at
0 points
Submitted by Simeng Xing
almost 7 years

what's the difference between "else if" and "elif" ?

what’s the difference between else if and elif ?

I was stopped here.

when I changed from *”else if”* to *”elif”* the program works.

why this happen?

is there any difference between the *”else if”* and *”elif”*

def shut_down(s):
if s == 'yes':
   return "Shutting down"
else if s == 'no':
   return "Shutdown aborted"
else :
   return "Sorry"

Answer 5398ac1b282ae333b4000c78

1 vote


In the lesson about elifs, it clearly states that elif only stands for else if, just shorter. So elif = else if BUT use elif NOT else if!!! Hope this helps!!! :)

499 points
Submitted by Soul
over 6 years


Soul over 6 years

Also Simeng, you need to indent the if, elif, and else statements otherwise it wont work!!! :)

Answer 5366beb47c82ca7928000f88

0 votes


elif is what python recognizes as else if so there is no difference

85 points
Submitted by Lopenguin
almost 7 years


Simeng Xing almost 7 years

Thank you for your help, but the problem is when I change “elif” to “else if” it will not work.

Matt almost 7 years

They are the same things, but python doesn’t understand “else if”. “else if” is syntax for another language (C++ as an example), while “elif” is syntax for Python!

Soul over 6 years

Yeah so elif = else if BUT use elif NOT else if!!! Hope this helps!!! :)