Relational operators always gives result in True or False.
The relational operators are as follows:
<, >, <=, >=, ==, !=
Relational operators can be used to compare strings also.
Every non zero integer is treated as True and only 0 is treated as False.
x=9
print(bool(x)) # True
"AB" >"CD" #False
<, >,<=,>= will not work on complex numbers. They will give error if applied.
True+5=6 # No conversion is required here
In python 5>4>3 gives True
5==5.0 gives True int and float can be compared.
5=="5" False
ord() method :
This method is used to calculate the unicode.
eg. print(ord('a')) #97
The relational operators are as follows:
<, >, <=, >=, ==, !=
Relational operators can be used to compare strings also.
Every non zero integer is treated as True and only 0 is treated as False.
x=9
print(bool(x)) # True
"AB" >"CD" #False
<, >,<=,>= will not work on complex numbers. They will give error if applied.
True+5=6 # No conversion is required here
In python 5>4>3 gives True
5==5.0 gives True int and float can be compared.
5=="5" False
ord() method :
This method is used to calculate the unicode.
eg. print(ord('a')) #97
Be First to Post Comment !
Post a Comment