Last Updated:

Not Equal Operator in Python : With Examples

Operators are used to perform various operations on variables and values. And our article is devoted to the different types of operators that are used in programming in python. Happy reading!

Not Equal Operator in Python

 

Arithmetic operators in Python

 

They are used to perform general mathematical operations:

+responsible for addition1 + 3
responsible for subtraction7 — 4
*responsible for multiplication3 * 2
/responsible for division8 / 4
%finds the remainder of division5 % 3
**raises a number to a power2 ** 3

Assignment operators in Python

 

This type of operator is used when you want to assign a specific value to a variable. Here are some examples:

=y = 8y = 8
+=y += 8y = y + 8
-=y -= 8y = y — 8
*=y *= 8y = y * 8
/=y /= 8y = y / 8
%=y %= 8y = y % 8
//=y //= 8y = y // 8
**=y **= 8y = y ** 8
&=y &= 8y = y & 8
|=y |= 8y = y | 8
^=y ^= 8y = y ^ 8
>>=y >>= 8y = y >> 8
<<=y <<= 8y = y << 8

Comparison operators in Python

Here everything is simple: they are used to compare two expressions.

==means equalityx == y
!=means inequalityx != y
>means more thanx > y
<means less thanx < y

Logical operators in Python

They are used to combine conditional statements:

isDisplays true if the variables are the samea is b
is notDisplays true, provided that the variables are differenta is not b

Bitwise operators in Python

Bitwise operators are used to work in bit (binary) format:

&Operator I. Setting the bit to 1, provided that both bits are equal to the same.
|The Or operator. Set the bit to 1, provided that one bit equals one.
^Operator Only or. Set the bit to 1, provided that only one bit equals one.
~This statement reverses all bits.
<<This statement shifts to the left by the number of bits that were specified on the right.
>>This statement shifts to the right by the number of bits that were specified on the left.