Comparison Operators in Python
October 26, 2020
In all programming languages you will find comparison operators. Comparison operators are used to compare two values. In this tutorial I will show you the comparison operators available in Python.
Now, let’s see the comparison operators in Python:
| Operator | Name | Example |
|---|---|---|
| == | Equal | x == y |
| != | Not equal | x != y |
| > | Greater than | x > y |
| < | Less than | x < y |
| >= | Greater than or equal to | x >= y |
| <= | Less than or equal to | x <= y |
Python Code with assignment & arithmetic operators:
x=5 y=6 z=x+y print(z)
Output:
11
In this tutorial, I have shown comparison operators in Python. Hope you have enjoyed the tutorial. If you want to get updated, like my facebook page http://www.facebook.com/freetechtrainer and stay connected.