 # Python Basics Tutorial 10 – Python Comparison Operators

### Notes from the video ‘Python Course Singapore | Learn Python Programming | Tutorial 10 – Python Comparison Operators’:

Comparison operators compare two things to see what’s the relationship between them.

## equal to sign (==)

In the previous videos, we learnt about the equal to sign (==). The equal to sign is a type of comparison operator. We use it to compare whether a variable is equal to a string, or a variable is equal to a number or perhaps another variable.

If the two values you are comparing is equal then the condition is true.

For example, 5 == 5 is true while 4 == 5 is not true.

Now, let’s look at other operators:

## not-equal to sign (!=)

The not-equal sign(!=) is the opposite of the equal to sign and it’s represented by an exclaimation mark followed by an equal sign.

For the not equal sign, if the two values you are comparing is not equal then the condition is true.

For example 5 != 5 is not true while 4 != 5 is true.

## greater than sign (>)

The next operator is greater than sign. It’s represented by the same greater than symbol we use in Math.

If the left value is greater than the value on the right then the condition is true.

For example, 5 > 4 is true while 4 > 5 is not true.

less than sign (<)

The next operator is less than sign. It’s represented by the same less than symbol we use in Math. If the left value is smaller than the value on the right then the condition is true.

For example, 5 < 4 is not true while 4 < 5 is true.

greater than or equal to (>=)

The next operator is greater than or equal to. It’s represented by the greater than symbol and the equal sign.

If the left value is greater than or equal to the value on the right, then the condition is true.

For example, 5 >= 4 is true while 4 >= 5 is not true.

## less than or equal to (<=)

The last operator we are looking at is less than or equal to. It’s represented by the lesser than symbol followed by the equal sign.

If the left value is less than or equal to the value on the right, then the condition is true.

For example, 5 <= 4 is not true while 4 <= 5 is true.