0

if 10 > 5: print("10 greater than 5") print("Program ended")

in the following example why the second print line dont give an error even though indentation is not applied

26th Jan 2017, 9:59 AM
kumar badal
kumar badal - avatar
2 Antworten
+ 3
cause its out of the if statement, that will print "10 is greater than 5" and "program ended" but if u put 10 < 5 on the condition or something else that is false it will only print "program ended" cause that is out of the if
26th Jan 2017, 10:05 AM
Kawaii
Kawaii - avatar
+ 1
Because after the if condition executes then run codes which are out of the if
3rd Feb 2017, 6:47 PM
sakuna