What are the Control Statements in Python?
It is common for programs to execute statements based on some conditions.
You can learn about python if .. else ... statement in this section.
First of all you should be aware of Relational operators.These are as follows:
|smaller than or equal to|
greater than or equal to
not equal to
Comparision will always result as a boolean value i.e True or False . True and False are python keywords.
|>>> 1 >4
>>> 3 == 3
>>> 12 >10
Now we'll learn the syntax of If statement :
Applying If statement to print even or odd:
|i = 4
if i % 2 == 0:
else is optional you can only use if clause if you want.
Tech writer at newsandstory
Total 106 views