---
title: "What is meant by comparison operators in python?"  
description: "What is meant by comparison operators in python?"  
author: "Amrita Bhattacharjee"  
published: 2023-03-28  
updated: 2023-04-20  
canonical: https://www.mindstick.com/forum/157626/what-is-meant-by-comparison-operators-in-python  
category: "python"  
tags: ["python"]  
reading_time: 2 minutes  

---

# What is meant by comparison operators in python?

What is meant by [comparison](https://www.mindstick.com/articles/23182/comparison-maruti-suzuki-celerio-v-s-tata-tiago) [operators](https://www.mindstick.com/articles/716/php-operators) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?Give suitable example.

## Replies

### Reply by Aryan Kumar

In Python, comparison operators are used to compare values and return a Boolean value (True or False) based on whether the comparison is true or false.

The following are the comparison operators in Python:

- **==**: Equal to
- **!=**: Not equal to
- **<**: Less than
- **>**: Greater than
- **<=**: Less than or equal to
- **>=**: Greater than or equal to

### Reply by Krishnapriya Rajeev

In Python, comparison operators are used to *compare two values* and *return a boolean* value *(True or False)* depending on the result of the comparison.

Python has six comparison operators in Python:

1. **== (equal to)**: This operator checks if two values are equal and returns True if they are, otherwise, it returns False.
2. **!= (not equal to)**: This operator checks if two values are not equal and returns True if they are not, otherwise, it returns False.
3. **> (greater than)**: This operator checks if the left operand is greater than the right operand and returns True if it is, otherwise, it returns False.
4. **< (less than)**: This operator checks if the left operand is less than the right operand and returns True if it is, otherwise, it returns False.
5. **>= (greater than or equal to)**: This operator checks if the left operand is greater than or equal to the right operand. If it's true, it returns True otherwise, it returns False.
6. **<= (less than or equal to)**: This operator checks if the left operand is less than or equal to the right operand. If it's true, it returns True otherwise, it returns False.

These comparison operators are used in conditional statements and loops to make decisions based on the result of the comparison.

Example:

```plaintext
# > operator
x = 5
y = 10
if x > y:
    print("x is greater than y")
else:
    print("x is not greater than y")
# OUTPUT: x is not greater than y
```


---

Original Source: https://www.mindstick.com/forum/157626/what-is-meant-by-comparison-operators-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
