Relational Operators are used to compare values.
Gives
True
or False
as the result of a comparison. These are different relational operators
Operator | Name |
---|---|
> | Is greater than |
< | Is less than |
== | Is equal to |
<= | Is less than or equal to |
>= | Is greater than or equal to |
!= | Is not equal to |
Code
PYTHON
Output
Possible Mistakes
Mistake - 1
Code
PYTHON
Output
Mistake - 2
Code
PYTHON
Output
Space between relational operators
==
, >=
, <=
, !=
is not valid in Python.Comparing Numbers
Code
PYTHON
Output
Comparing Integers and Floats
Code
PYTHON
Output
Comparing Strings
Code
PYTHON
Output
Case Sensitive
Code
PYTHON
Output
Python is case sensitive. It means
X
(Capital letter) and x
(small letter) are not the same in Python.Strings and Equality Operator
Code
PYTHON