Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python comparison operators

# Let's learn the comparison operators in Python
x = 5
# Equal to
if x == 5:
    print('X is equal to 5')
# Greater than
if x > 4:
    print('X is greater than 4')
# Greater than or equal to
if x >= 5:
    print('X is greater than or equal to 5')
# Less than
if x < 6:
    print('X is less than 6')
# Less than or equal to
if x <= 6:
    print('X is less than or equal to 6')
# Not equal
if x != 6:
    print('X is not equal to 6')
Source by www.pythoncheatsheet.org #
 
PREVIOUS NEXT
Tagged: #python #comparison #operators
ADD COMMENT
Topic
Name
5+4 =