xxxxxxxxxx
print(10 > 9)
print(10 == 9)
print(10 < 9)
#conditional statment
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")
xxxxxxxxxx
>>> # The not operator is the opposite of it
>>> not True
False
>>> not False
True
>>> # The and operator is True only if both are are true
>>> True and True
True
>>> False and True
False
>>> False and False
False
>>> # The or operator is True if either of them are true
>>> True or True
True
>>> False or True
True
>>> False or False
False
xxxxxxxxxx
>>> type(True)
<class 'bool'>
>>> type(true)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
NameError: name 'true' is not defined
xxxxxxxxxx
The Python Boolean type is one of Python's built-in data types. It's used to represent the truth value of an expression. For example, the expression 1 <= 2 is True , while the expression 0 == 1 is False .
xxxxxxxxxx
i = 5
ii = 10
if i == 5 and ii == 10:
print "i is 5 and ii is 10"
xxxxxxxxxx
x = bool(0)
y = bool(1)
print(x, y)#It will show "TRUE False" as through the boolean it's done.
xxxxxxxxxx
password = "12345"
confirm_password = "12345"
print(password == confirm_password)