Python Conditions and
If statements
Python supports the
usual logical conditions from mathematics:
1. Equals: a == b
2. Not Equals: a != b
3. Less than: a < b
4. Less than or equal
to: a <= b
5. Greater than: a >
b
6. Greater than or
equal to: a >= b
Example:
if b > a:
print("b
is greater than a")
Python if...elif...else Statement
if test
expression:
Body of if
elif test expression:
Body of elif
else:
Body of else
No comments:
Post a Comment