Operators

OPERATORS 


1. Arithmetic Operators:

Operator

Name

Example

+

Addition

a + b

-

Subtraction

a - b

*

Multiplication

a * b

/

Division

a / b

%

Modulus

a % b

**

Exponentiation (Return Power)

a ** b

//

Floor Division (Return Value without Decimal)

a // b

       


2. Comparison Operators:

Operator

Name

Example

==

Equal

a == b

!=

Not equal

a != b

Greater than

a > b

Less than

a < b

>=

Greater than or equal to

a >= b

<=

Less than or equal to

a <= b

 
 


3. Logical Operators:

Operator

Name

Example

and

Return True if both statements are true.

7 > 3 and 10 < 15

or

Return True if one statement is true.

5 > 10 or 13 < 20

not

Return False if the result is true, and return True if the result is false.

not(7 > 3 and 10 < 15)


       

Comments