+ 1

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

23rd May 2017, 2:01 PM
Roman Ilyin
Roman Ilyin - avatar
4 Antworten
+ 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