Whether it is possible to use "endif" in construction of if else... ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whether it is possible to use "endif" in construction of if else... ?

23rd May 2017, 2:01 PM
Roman Ilyin
Roman Ilyin - avatar
3 Answers
+ 1
Python uses indentation to end a block of code. So if you have a conditional like if or else, it is followed by indented code underneath that is executed if the condition is met. ex: python = True if python: print ("yay python!") else: print ("maybe someday")
23rd May 2017, 2:12 PM
Sapphire
0
That is rather blank line after the unit and Python itself will understand that the unit ended? Ok. :)
23rd May 2017, 2:24 PM
Roman Ilyin
Roman Ilyin - avatar
0
Technically you can press the spacebar once and python accepts that just fine. But for readability sake, more is prefered. About 4-6 spaces. Most use the TAB key as a quick way to indent.
23rd May 2017, 2:31 PM
Sapphire