+ 2
Are elif and else the same
5 Réponses
+ 6
"Else if" is used as "elif" in python it can be used as 'else if' also but for simplicity "elif" is used more frequently
refer this for more
https://www.sololearn.com/learn/Python/2278/
+ 4
Else does not need a condition but elif does.
+ 3
They are different.
+ 2
danayt
if is a first level of condition
elif is middle level of condition
and
else is last level of condition means if 1st and middle level condition will be fail then else will be execute.
Example:
if(age < 18):
print ("First level")
elif(age > 18 and age < 60):
print ("Middle level")
else:
print ("Last level")
+ 1
The last elif is similar,but followed by condition statements,so they are not the same exactly