# Basic syntax:
1 < b <= 3:
# Note, in Python it's common to see comparisons like:
if a < b and b <= c :
{...}
# however, the above syntax can be used to express things more succintly (and
# more similarly to the mathematical notation for inequalities)
# Other comparison operators that can be "chained":
# > | < | == | >= | <= | != | is [not] | [not] in
# Example usage:
# Say you wanted to check whether your_variable was greater equal to 5 and
# also not a member of your_list, you could write this as:
5 <= your_variable not in your_list
# which will evaluate to true or false
# Below follow the comparison operators that can be used in python
# == Equal to
42 == 42 # Output: True
# != Not equal to
'dog' != 'cat' # Output: True
# < Less than
45 < 42 # Output: False
# > Greater Than
45 > 42 # Output: True
# <= Less than or Equal to
40 <= 40 # Output: True
# >= Greater than or Equal to
39 >= 40 # Output: False
# 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')
number_of_seats = 30
numbre_of_guests = 25
if numbre_of_guests <= number_of_seats:
print("it's ok")
else:
print("it's not ok")
# Examples of Relational Operators
a = 13
b = 33
# a > b is False
print(a > b)
# a < b is True
print(a < b)
# a == b is False
print(a == b)
# a != b is True
print(a != b)
# a >= b is False
print(a >= b)
# a <= b is True
print(a <= b)
'GE' in VINIX
>>> False
'GOOGL' in VINIX
>>> True