Crus4

# What are Relational Operators in Python

Relational Operators in Python are used to compare two values using Comparison Operators and return a result in Boolean values, either ‘True’ or ‘False’.

As the name suggests, Relational Operators are used to determine the relationship between two operands.

There are mainly six commonly used Relational Operators in Python. All these six operators allows us to compare values and determine the relationship between them. Here is a list of these six relational operators.

These operators are used to compare and control the flow of Python program. We can also use these operators in conditional statements, loops and other parts in our python code, to make decisions based on the relationships between two values.

### Examples of Python Relational Operators

Using Equal to Operator

```x = 5
y = 4
print (x == y) #Outputs: False```

In an above code we use the Python Equal to operator and compare the two values, x and y. It outputs ‘False’ because the value of y is not equal to value of z.

Using Less than Operator

```x = 9
y = 14
print (x < y) #Outputs: True```

In an above code the value of x is less than the value of y, so it outputs True.

Using Greater than or equal to Operator

```x = 19
y = 7
print (x >= y) #Outputs: True```

In an above code the value of x is greater than the value of y, so the result we get is True. Even the value of x is equal to the value of y still we get an output True, because we have used the Greater or equal to operator.

NOTE:- Relational Operators are used to compare two values at a time. If you want to compare three or more values then use Python Logical Operator.