Python If Else Statements
The If statement is used to test specified condition and if the condition is true, if block executes, otherwise else block executes.The else statement executes when the if statement is false.
Python If Else Syntax
if(condition): False
statements
else: True
statements
Example-
year=2000
if year%4==0:
print "Year is Leap"
else:
print "Year is not Leap"
Output:
Year is Leap
Thanks for helping us learning python...Keep this work up.
ReplyDeleteWeb app development company Islamabad