Another type in Python is the Boolean type. There are two Boolean values: True and False.
They can be created by comparing values, for instance by using the equal operator ==.
>> my_boolean = True
>>> 2 == 3
>>> “hello” == “hello”
Another comparison operator, the not equal operator (!=), evaluates to True if the items being compared aren’t equal, and False if they are.
>> 1 != 1
>>> “eleven” != “seven”
>>> 2 != 10
Python also has operators that determine whether one number (float or integer) is greater than or smaller than another. These operators are > and < respectively.
>> 7 > 5
>>> 10 < 10
The greater than or equal to, and smaller than or equal to operators are >= and <=.
They are the same as the strict greater than and smaller than operators, except that they return True when comparing equal numbers.
>> 7 <= 8
>>> 9 >= 9.0
CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE.
©️ License: All Rights Reserved
CONTACT HOLLA TECH – LEARN SUPPORT