+ 2

"elif" and "else"

When using "elif" and "else" after the "if" statement, do you have to indent the "elif" and "else"?

14th Mar 2018, 6:19 PM
arbaaz
4 Antworten
+ 6
Both elif and else will have the same indentation as if like below a == 2 if (a==1): print (a) elif(a==2): print (a) else: print (a)
14th Mar 2018, 6:26 PM
kaliki chandu
kaliki chandu - avatar
+ 1
I'm sorry. The programming language is Python.
15th Mar 2018, 10:00 PM
arbaaz