if True:
print " Validation success ";
print "Continue to proceed more steps ";
else:
print " Validation failure ";
print " Try again ";
In the above example after the if condition without using braces, it is possible to execute more that one line of commands by maintaining indentation of the each lines. This indentation helps to varies the different blocks while executing in the program.
Check the screenshot of source file and its corresponding output while indentation varies on the program.
Correct Source Screenshot :
Correct Source Output Screenshot :
If the indentation changes in order it will provide indentation error. We made indentation space in different order. It gives the inderntation error show below.
Indentation Changed Source Screenshot :
see there is in True block, first print statement and second print statement indentation order.
Indentation Changed Source Output Screenshot :
I think you will clear understand about Lines and Indentation in Python Program.
If you have any queries post below in comment box. We will help you.
Thank you.
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.