# Relational Operators in Python

• Difficulty Level : Medium
• Last Updated : 29 Aug, 2020

Relational operators are used for comparing the values. It either returns True or False according to the condition. These operators are also known as Comparison Operators.

Now Let’s see each Relational Operator one by one.

1) Greater than: This operator returns True if the left operand is greater than the right operand.

Syntax:

```x > y
```

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a > b)`

Output:

```True
```

2) Less than: This operator returns True if the left operand is less than the right operand.

Syntax:

```x < y
```

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a < b)`

Output:

```False
```

3) Equal to: This operator returns True if both the operands are equal i.e. if both the left and the right operand are equal to each other.

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a ``=``=` `b)`

Output:

```False
```

4) Not equal to: This operator returns True if both the operands are not equal.

Syntax:

```x != y
```

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a !``=` `b)`

Output:

```True
```

5) Greater than or equal to: This operator returns True if the left operand is greater than or equal to the right operand.

Syntax:

```x >= y
```

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a >``=` `b)`

Output:

```True
```

6) Less than or equal to: This operator returns True if the left operand is less than or equal to the right operand.

Syntax:

```x <= y
```

Example:

## Python3

 `a ``=` `9` `b ``=` `5` ` `  `# Output ` `print``(a <``=` `b)`

Output:

```False
```

My Personal Notes arrow_drop_up
Recommended Articles
Page :