0% found this document useful (0 votes)
6 views

Operators

Uploaded by

Naseema Begum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Operators

Uploaded by

Naseema Begum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1

2
Python Arithmetic
Operators Arithmetic operators are used with numeric values to
perform common mathematical operations:

Operator Name Example

+ Addition x+y

- Subtraction x-y

* Multiplication x*y

/ Division x/y

% Modulus x%y

** Exponentiation x ** y
Try

4
Python Assignment
Operators
Assignment operators are used to assign
values to variables:

Operator
=
Example
x=5
Same As
x=5
!
+= x += 3 x=x+3
-= x -= 3 x=x-3
*= x *= 3 x=x*3
/= x /= 3 x=x/3
%= x %= 3 x=x%3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
&= x &= 3 x=x&3
|= x |= 3 x=x|3
^= x ^= 3 x=x^3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3
:= print(x := 3) x=3
print(x)
Python Comparison Operators

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


try

x=5
y=3

print(x == y)

# returns False because 5 is not equal to 3


THANK YOU

Neal Creative © Neal Creative | click & Learn more

You might also like