0% found this document useful (0 votes)
5 views8 pages

Operators

Uploaded by

Naseema Begum
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
5 views8 pages

Operators

Uploaded by

Naseema Begum
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
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